Hi
I have a lot of photos in a lot of folders (all under the /stars folder) and every picture has a thumbnail, too. The thumbnails have a '_t' in their name, like this 'picname_t.jpg'.
What I'd like to do is to delete all the thumbs ('*_t.jpg' files) recursively, using one ssh command for the /stars folder.
How can I do this?
Thanks.
P.S. if it matters, some folders inside /stars have spaces in their names and I'm using Putty to access the server.

I would change in to the stars folder then run this command:

find -name *_t.jpg -delete

It will find all files ending in _t.jpg recursively and delete them.

- Joe

It didn't worked for my server but I used this

find . -name \*_t.jpg -delete

Anyway, it's your credit, I didn't know about the find command
Thanks, Joe

If you ever need to look for a command that does something, you can use

apropos search

i.e. if you were looking for a way to delete files

apropos delete

would give you something like:

argz_delete (3)      - functions to handle an argz list
at (1)               - queue, examine or delete jobs for later execution
atq (1)              - queue, examine or delete jobs for later execution
atrm (1)             - queue, examine or delete jobs for later execution
batch (1)            - queue, examine or delete jobs for later execution
bleachbit (1)        - Delete unnecessary files from the system
control-alt-delete (7) - event signalling console press of Control-Alt-Delete
git-branch (1)       - List, create, or delete branches
git-replace (1)      - Create, list, delete refs to replace objects
git-tag (1)          - Create, list, delete or verify a tag object signed wit...
groupdel (8)         - delete a group
lh_delete (3ssl)     - dynamic hash table
lppasswd (1)         - add, change, or delete digest passwords.
mdel (1)             - delete an MSDOS file
mdeltree (1)         - recursively delete an MSDOS directory and its contents
ntfsundelete (8)     - recover a deleted file from an NTFS volume.
rmdir (2)            - delete a directory
shred (1)            - overwrite a file to hide its contents, and optionally ...
tdelete (3)          - manage a binary tree
timer_delete (2)     - delete a POSIX per-process timer
tr (1)               - translate or delete characters
unlink (2)           - delete a name and possibly the file it refers to
userdel (8)          - delete a user account and related files
X509_NAME_delete_entry (3ssl) - X509_NAME modification functions
XDeleteContext (3)   - associative look-up routines
XDeleteModifiermapEntry (3) - manipulate keyboard encoding and keyboard encod...
XDeleteProperty (3)  - obtain and change window properties

Not everything on the list is entirely pertinent, but you might discover some cool new tools that could be useful some day.

Happy to help,
- Joe

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.