Skip to main content

Thread: Finding and deleting directories and files with similar names


on computer there 900 redundant internet folders extension
"_files". in addition there corresponding .htm or .html files. these files
not within folders having extension "_files". within
same directories folders having extension "_files"

redundant folders on place, in various directories. , the
time rid of them. , associated htm , html files.

best way carry out purge few command-line
operations?

know how find folders:

$ find ~ -name \*\\_files\* > folders.txt

produces text list of redundant folders have.



- take name of each folder without _files extension
- delete corresponding .htm or .html file
- delete folder
- , move on recursively other directories

how can capture name of each folder , use
delete first named htm/html file ,
delete folder itself?

please can me? 900+ if can.

will command list 'remove commands files want remove, no other files'? try (it lists commands due echo.)
code:
sudo find ~ -name "*_files*" -exec echo rm -r {} \;
if happy it, remove 'echo' line , run real command.

warning: remove files in directories matching search pattern. want?


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support New to Ubuntu Finding and deleting directories and files with similar names


Ubuntu

Comments

Popular posts from this blog

Some mp4 files not displaying correctly (CS6)

Thread: Samba is not authenticating with LDAP