Computing.Net > Forums > Unix > How to move files from one dir to a

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How to move files from one dir to a

Reply to Message Icon

Name: nkbeet (by nk.mtnl)
Date: June 17, 2008 at 08:54:29 Pacific
OS: UNIX
CPU/Ram: SERVER
Product: IBM
Comment:

Dear Friends,
I have a directory named tech, there are many files with *.uni extensions in this directory.The files with *.uni are continuously coming in tech directory.In tech directory, there is one directory named best. Now i want to move the files with *.uni extensions in this best directory. How can i do that. Please suggest a script in UNIX for this.

NAVIN KUMAR



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: June 17, 2008 at 09:54:19 Pacific
Reply:

The typical way of moving files and directories is with the mv command:

cd /pathto/tech
mv *.uni best

The above contains no error checking, so use the cp command until you get the script the way you want it.

Check out this link for more info on this topic:

http://students.cs.unipi.gr/pub/doc...


0

Response Number 2
Name: nkbeet (by nk.mtnl)
Date: June 18, 2008 at 00:12:39 Pacific
Reply:

Error "arguments too long" comes.

NAVIN KUMAR


0

Response Number 3
Name: nails
Date: June 18, 2008 at 09:06:19 Pacific
Reply:

You must be trying to move a very large number of files to get a "arguments too long" error. Generally, you can get around the "arguments too long" problem by using a combination of the find/xargs command.


Read about it in this online article, "Using the xargs Command":
http://www.unixreview.com/documents...

You can probably do something like this:

# untested untested untested
cd /pathto/tech
find ./ -type f -name "*.uni" -print | xargs -l56 -i mv -f {} ./best

I suggest you read the article.

I see another potential problem with having directory "best" right below the current directory. The find command probably will probably find those "uni" files.


0

Response Number 4
Name: nkbeet (by nk.mtnl)
Date: June 23, 2008 at 00:15:35 Pacific
Reply:

This also not worked.

nkbeet


0

Response Number 5
Name: nails
Date: June 23, 2008 at 11:36:04 Pacific
Reply:

You'd get more help if you posted WHY it didn't work. Also, asking the same question in a different thread won't do you much good either.


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: How to move files from one dir to a

running unix scripts remotely using www.computing.net/answers/unix/running-unix-scripts-remotely-using/3762.html

moving recursively direcotries www.computing.net/answers/unix/moving-recursively-direcotries/6930.html

Correct FTP permission settings? www.computing.net/answers/unix/correct-ftp-permission-settings/1306.html