Find file type recursively and move


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find file type recursively and move
# 1  
Old 09-10-2018
Find file type recursively and move

Hello,
I supposed that it was working fine but now I see that it's not working as expected.
I am running under ubuntu14.04, trusty.

My plan was to search folderA and all subdirectories and move any txt file to destination folder, folderB :

Code:
find /home/user/folderA/ -type f -iname "*.txt" -exec mv --backup=numbered \ 
-t /home/user/folderB {} +

Now I see a new folder was created ,by another process, under folderA , named folderC and it contains multiple text files but the script does not see txt file.

What could be the correct way?

Many thanks
Boris



Hello,
After a couple of tests, I realized that there were some colliding applications over the same folders. So, I have just sorted out now.

Many thanks
Boris

Last edited by baris35; 09-10-2018 at 06:02 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can I use find command to search string/pattern in a file recursively?

Hi, How can I use find command to search string/pattern in a file recursively? What I tried: find . -type f -exec cat {} | grep "make" \; Output: grep: find: ;: No such file or directory missing argument to `-exec' And this: find . -type f -exec cat {} \; -exec grep "make" {} \;... (12 Replies)
Discussion started by: cola
12 Replies

2. UNIX for Dummies Questions & Answers

Find and rename file recursively

Hi, I have a directory which contains multiple files with .txt extension, i want to rename all these file to .bak extension using find command, this is what i've tried, please help me to correct this : find /home/application/test -name '*.txt' -exec rename 's/txt/bak/' {} \; seems to... (8 Replies)
Discussion started by: mukulverma2408
8 Replies

3. Shell Programming and Scripting

How I can find the last file created and move it to a directory?

I have this situation /u03/app/banjobs> ls -ltr icg* 82 Jun 12 10:37 iicgorldi_2419186.log 56810484 Jun 17 10:35 icgorldi_2421592.xml 2859 Jun 17 10:35 icgorldi_2421592.lis - 125 Jun 17 10:35 icgorldi_2421592.log 82 Jun 12 10:37 iicgorldi_2419187.log ... (8 Replies)
Discussion started by: Bernardo Jarami
8 Replies

4. Homework & Coursework Questions

Shell script to find file type

1. The problem statement, all variables and given/known data: Write a shell script that takes a single command line parameter, a file path (might be relative or absolute). The script should examine that file and print a single line consisting of the phrase: Windows ASCII if the files is an... (4 Replies)
Discussion started by: kwatt019
4 Replies

5. UNIX for Dummies Questions & Answers

Move Multiple Files adding date timestamp before file type

There are files in a directory and I have to move multiple files adding datetimestamp before the file type. /Data/ abc.csv def.csv ghi.csv I have to move this files to archive directory adding datatimestamp before .csv /archive/ abc_YYYYMMDDHHMMSS.csv def_YYYYMMDDHHMMSS.csv... (7 Replies)
Discussion started by: eskay
7 Replies

6. Shell Programming and Scripting

how to find a pattern from an external file in a directory containing multiple file recursively

Hi, Need your help in this. I have an input file that has multiple enrollment_number, somewhat like 1234567 8901234 9856321 6732187 7623465 Now i have to search and delete these enrollment_number recursively from all the files that are within multiple sub-directories of a... (10 Replies)
Discussion started by: mukulverma2408
10 Replies

7. Shell Programming and Scripting

Deleting all files recursively from directories while ignoring one file type

Hi, Seems like I need help again with a problem: I want to delete all files from my lets say "Music" Directory inkluding all of the subfolders except for .mp3 and .MP3 files. I tried it with globalignoring mp3 files, finding and deleting all other files, which resulted in all files... (3 Replies)
Discussion started by: pasc
3 Replies

8. Shell Programming and Scripting

Recursively move a subfolder to one upper level

Hi, all: My folder structure is like: What I'm expecting to realize is to have my folders look like: How to realize it? Cheers Pei (0 Replies)
Discussion started by: jiapei100
0 Replies

9. UNIX for Dummies Questions & Answers

Assistance with shell script to check file type and move to a folder.

Hi, Below is some code that I would like to implement however I am getting these errors: (what I am attempting to do is to check if a zip file has ascii files and if ascii and not binary then move the ascii files to a folder. some of the files are in xml format but are ascii and i will be moving... (0 Replies)
Discussion started by: bwcberb
0 Replies

10. UNIX for Dummies Questions & Answers

How to move recursively into one folder

Hi, I have a folder with a million subdirectories which all have a million files in them (some of them duplicates).. I am looking for the right program command to move all of the files out of the directories and into one folder-- and replace all of the duplicates.. If anyone has any ideas,... (2 Replies)
Discussion started by: patrick99e99
2 Replies
Login or Register to Ask a Question