Questions tagged [recursive]

Operating on a directory and its subdirectories, recursively.

Use this tag when an important part of your question is to operate on a directory, its subdirectories, its sub-sub-directories, etc., and some or all the files in these directories.

346 questions
13
votes
2 answers

Why doesn't recursion go upwards with rm?

I'm wondering about direction of recursion in general and rm specifically. rm recursion only works downwards correct? Running: sudo rm -R *.QTFS will delete all *.QTFS files in current directory and its children, correct? current directory as…
user66044
1
vote
2 answers

Copy folders to another set of directories, only if folders already exist

I want to copy (overwrite) folders from one directory to another set of directories, only if the folders in directory1 exist in directory2. For example, I have stored some folders in my home directory: home |admin |updates …
0
votes
0 answers

Run script recursively

I have a script that will concat and rename the video files in a folder which I have pieced together using tips from StackExchange. #!/bin/bash ls -d $PWD/* >> file.txt sed -i "s/^\|$/'/g" file.txt sed -i -e 's_.*_file &_' file.txt ffmpeg -f concat…
AKDub
  • 11
0
votes
3 answers

Sort output of find command, read back in to remove files

The following bash script searches through all directories and tabulates how many files are in each directory. Sample output testing on my own R installation is below - exactly what I need. find . -mindepth 6 -type d -print0 | while IFS= read -r -d…
0
votes
1 answer

Copy files from a source folder recursively to destination/*file_extension*(ex. "txt") folder

This is my code, something in the rec_copy() function isn't working properly, the extension named folders are created in the destination folder but the files are not copied there. #!/bin/bash if [ $# -ne 2 ] then echo "Usage: $0
kazioX
  • 1
-1
votes
1 answer

Unix script that will recursively look for specific names

Trying to find a Unix script that will recursively look for directories/files that contain in their name " backup ", "back" etc. or more than 6 numbers, so it can find those that have a date. Thank you!
Edd
  • 7
  • 1