I have a folder with thousands of files each named
image0000.png
image0001.png
image0002.png
...etc
I need to edit this sequence by deleting every 40th file then renaming the sequence so that there are no breaks in the image sequence names. Whats the simplest way of doing this, with ubuntu? I dont mind if this means using the CLI or if there is a gui for something like this.
Ok I did my homework and this seems to work
mv $(ls | awk '{nr++; if (nr % 40 == 0) print $0}') ~/destinationFolder
and then used Thunar Bulk Rename utility to rename the files left in the original folder.
Or simply
mv $(ls | awk '!(FNR%40)' ) ~/destinationFolder
FNR
denotes the current record number which increments with each record in the file until EOF
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.