swanand100
Programmer
I have a script to move files of type .txt to a particular folder .It looks for the files in work folder and move it to completed folder.
Example: It takes the .txt file from /tmp/swan/test/work to /tmp/swan/test/completed, but I would like the script to also move the files from a subfolder to the completed folder(which it is not doing as of now). Example : Files from /tmp/swan/test/work/APX should move to /tmp/swan/test/completed
Below is the current script.
#!/bin/bash
MY_DIR=/tmp/swan
cd $MY_DIR
find . -path "*work*" -iname "*.txt" -type f -execdir mv '{}' ../completed\;
Example: It takes the .txt file from /tmp/swan/test/work to /tmp/swan/test/completed, but I would like the script to also move the files from a subfolder to the completed folder(which it is not doing as of now). Example : Files from /tmp/swan/test/work/APX should move to /tmp/swan/test/completed
Below is the current script.
#!/bin/bash
MY_DIR=/tmp/swan
cd $MY_DIR
find . -path "*work*" -iname "*.txt" -type f -execdir mv '{}' ../completed\;