issue while moving files using find command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting issue while moving files using find command
# 1  
Old 02-08-2012
Question issue while moving files using find command

Hi Friends,

I'm facinf issue while moving large files using find command.I've a scenario like i've to move one day older files from one directory to anothe directory.I'm using the below command.

find $src_dir -name error -prune -o -type f -mtime +1 -exec mv {} $dest_dir \;

some times it's not working.particularly it's not working for large files.It 's throwing the below error

mv: dest_dir/file_name: A file or directory in the path name does not exist


pls help me friends to solve this.i wnat to know why it's acting like this...Smilie

Last edited by mail2mura; 02-08-2012 at 10:27 AM..
# 2  
Old 02-08-2012
@mail2mura
Please edit you post to remove typing errors. The command looks unlikely (with the #) and the error message is impossible (with the $).

Addenda:
If $dest_dir is a subdirectory of $src_dir there is considerable scope for this script to go wrong.

Last edited by methyl; 02-08-2012 at 10:24 AM..
This User Gave Thanks to methyl For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find command issue

Hi Guys, I have a file called error.logs. am just trying to display the content in the file which was modified last 1 day. I tried below command but it doesnt give the proper output. find /u/text/vinoth/bin "error.logs" -mtime -1 -exec cat {} \; >> mail.txt Any help is much... (21 Replies)
Discussion started by: Vinoth Kumar G
21 Replies

2. Shell Programming and Scripting

Issue in Find and mv command

Hi I am using the below code to find mv the files. Files are moving to the Target location as expected but find is displaying some errors like below. find ./ -name "Archive*" -mtime +300 -exec mv {} /mnt/X/ARC/ \; find: `./Archive_09-30-12': No such file or directory find:... (6 Replies)
Discussion started by: rakeshkumar
6 Replies

3. Shell Programming and Scripting

Find command issue

Guys, Here is my requirement.. Sample.cfg file="*log.gz *txt.gz" sample.sh #!/bin/sh . $HOME/Sample.cfg find . -name "$file" -mtime +20 -exec ls -la {} \; Its not finding the given *log.gz and txt.gz files. Could anyone please help me? (8 Replies)
Discussion started by: AraR87
8 Replies

4. Shell Programming and Scripting

Issue while moving files using find command

Hi All, I'm facing this below error when I move files using find command....Please help out...... $ find /home/aa/ab -mtime +90 -type f -exec mv -f {} /home/aa/ab/ac \; mv: 0653-405 /home/aa/ab/ac/MP_060520111245.csv and /home/aa/ab/ac/MP_060520111245.csv are identical. mv: 0653-405... (2 Replies)
Discussion started by: HemaV
2 Replies

5. Shell Programming and Scripting

Issue with Find Command

Hi All, I'm a bit new to Linux environment, moderately okay when it comes to Unix AIX. I'm facing an issue while trying to run a simple find command: $ for file in `find . -name *.*` > do > ls $file > done This is throwing the following error: Strangely, a few minutes... (4 Replies)
Discussion started by: adi_2_chaos
4 Replies

6. UNIX for Dummies Questions & Answers

Find command issue

I am currently using below command to get the 1st three characters of a file(PDM). Issue is, when i use find command in root dir, it finds all the files in sub dir also. How to limit the find command search to a given path only(ie: say only find file in apps/cmplus/datamigration/data path... (3 Replies)
Discussion started by: abhi_n123
3 Replies

7. Shell Programming and Scripting

using mv command for moving multiple files in a folder

Hi, I have a requirement where I need to move Bunch of folders containing multiple files to another archive location. i want to use mv command .I am thinking when we use mv command to move directory does it create directory 1st and then move all the files ? e.g source... (4 Replies)
Discussion started by: rkmbcbs
4 Replies

8. Shell Programming and Scripting

moving files alone using mv command??

Is there a way to move the files ALONE from one dir to another dir? In my source dir,I have files as well as directories.I want to move the files alone to another dir and the directories should remain undisturbed. If I use mv * < target dir> ,then the directories also moved. Any... (4 Replies)
Discussion started by: prasperl
4 Replies

9. Shell Programming and Scripting

moving files after ls -lt command

Can you please tell me how to find a file in a directory and then if it exists i need to place it in a different folder? I have to use "ls -lt" command I mean this command is something existing one . can you please tell me how i set the directory path. Like dir1/dir2/filename.csv to... (8 Replies)
Discussion started by: pochaman
8 Replies

10. Shell Programming and Scripting

An issue with find command.

Hi all, I have a shell script(ksh) which has the code as follows. ------------------ cd $mydir for i in `find ./ -type f -mtime +$k` do echo $i done ----------------------- And in $mydir , i have some files which have space in theie names like "Case att15". The out put of the... (6 Replies)
Discussion started by: rajugp1
6 Replies
Login or Register to Ask a Question