Hot answers tagged

4

Try: find . -mindepth 2 -type f -name '*.pdf' -exec bash -c 'f=${1#./}; mv "$1" "./${f//\//_}"' None {} \; This is safe for all file names, even ones with newlines in their names. How it works -mindepth 2 This tells find not to process any files that are already in the current directory. -type f -name '*.pdf' This restricts the search to regular ...


1

I thought of using the -exec option for find but this would not work due to the redirection operator used with the gunzip command. One solution would be to perform the operation in two steps: 1. Copy the archives into $NEWDIR: while read line do find "$PARENTDIR" -name "$line*" -exec cp -v {} "$NEWDIR" \; done < "$LIST" This should ...


1

It's pretty easy to accomplish this task and I use this method all the time. Navigate to the directory in question. Press SHIFT + Right Click (on a blank section of the folder). Select, "Open command window right here". A terminal session will open in this directory. While you are in this directory you can make the subfolders you wish now either by using ...


1

I was able to find your examples with the following wildcard search: Find: [dD][.lL]{1,2}[gG][sS.]{1,2} Replace: D.Lgs. The square brackets limit the characters we're looking for. By separating them out, we can include the . where it may be (or may not be - ie 0 occurrence). By including the . (which may or may not be there) with the next expected ...


1

This one should work: for DIR in {the folder list}; do if [[ $(find ${DIR} -mtime -10 -type f) == "" ]]; then echo ${DIR} fi done It finds all directories in {the folder list}, that contains files older than 10 days. Basically what find ${DIR} -mtime -10 -type f does is to find all files (-type f) that are modified within 10 days (-mtime -...



Only top voted, non community-wiki answers of a minimum length are eligible