I just unarchived a file and it threw about 1,000 files into my /root/Downloads directory.
Luckily, Rox will bold all files that are new. I had to hunt them down to delete them all.
Can a bash script find and delete files with bold filenames?
Moderator: Forum moderators
I just unarchived a file and it threw about 1,000 files into my /root/Downloads directory.
Luckily, Rox will bold all files that are new. I had to hunt them down to delete them all.
Can a bash script find and delete files with bold filenames?
Clicking the "Last Modified" column in Rox might concentrate all the new files together, making it easy to select all of them and then delete them.
Flash wrote: Tue Jul 16, 2024 5:27 pmClicking the "Last Modified" column in Rox might concentrate all the new files together, making it easy to select all of them and then delete them.
This would work only if all the copied files have the same "Last Modified" timestamp, which is very unlikely.
What would work is to sort the files by "Last Changed", in this case that's the time the files were copied. Even without a dedicated "Last Changed" column sorting can be done using the right click menu: Display > Sort by Date (ctime). The ctime is also used by ROX for its bold formatting. All files with a "Last Changed" time of less than 5 minutes ago are displayed in bold font.
If the files are concentrated in one folder it's easy. It becomes tricky when the unarchived files are copied all over the place, and things get worse when you discover the mistake days later. A script could help. Basically it could use the find command to find all files in the system with a particular Changed date, then delete them. It's not as trivial as it sounds, but possible.
Thanks for the clarification.
Rather than let the 'find' script delete the files, it might be prudent to instead have it move them to a directory where they could be inspected before deletion.
I recently had a similar situation where I unarchived a folder, and it felt like I was drowning in new files. Unfortunately, you can’t really target bold filenames with a bash script since that’s just how the file manager shows them. A good workaround is to look for files based on when they were created. For instance, you could use find /root/Downloads -type f -mtime -1 -exec rm {} + to find and delete files modified in the last day.