The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Moving files not directory. senthil_is Shell Programming and Scripting 1 05-09-2008 01:21 AM
Getting unusual error - moving files to another directory aismann Shell Programming and Scripting 4 12-21-2007 03:29 AM
Mutiple For loops - moving files to another directory tekster757 Shell Programming and Scripting 9 06-21-2007 08:42 AM
How to Compress files before moving them in a directory godalle Shell Programming and Scripting 3 11-10-2005 11:59 AM
moving files from a unix directory to a windows directory gleads UNIX for Dummies Questions & Answers 2 08-29-2002 08:42 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-26-2008
gav_dhiman gav_dhiman is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 10
Moving all user files to another/new directory

Hi Experts,

I need your help for a new query. Query is to move all specified user files from a specified directory to another directory.

eg

i've 5 files in /export/home/users created by the gaurav(unix ID). i want to move all 5 files of gaurav from /export/home/users to /export/home/users/new_folder.

Thanks in advance.

regards,
Gaurav
  #2 (permalink)  
Old 08-26-2008
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,546
Is the old directory to remain?
  #3 (permalink)  
Old 08-26-2008
gav_dhiman gav_dhiman is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 10
Yes, please. It contain lot of other stuff too from other users.
  #4 (permalink)  
Old 08-26-2008
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,546
go to the directory, get the user UID (id user).

then
mv or cp -pR $(find . -user UID -print) ~newdirectory
(but after cp you will have to remove them the same way... but at least you can see if the files copied are what you wanted...)
  #5 (permalink)  
Old 08-26-2008
elzalem's Avatar
elzalem elzalem is offline
Registered User
  
 

Join Date: Nov 2006
Location: Lebanon
Posts: 33
$ cd /export/home/users/
$ mkdir ./new_folder
$ cp ./file1 ./file2 ./file3 ./file4 ./file5 ./new_folder/

this will copy the 5 files to 'new_folder'

if u want to move them, simply type mv instead of cp

hope this is what you need
  #6 (permalink)  
Old 08-26-2008
elzalem's Avatar
elzalem elzalem is offline
Registered User
  
 

Join Date: Nov 2006
Location: Lebanon
Posts: 33
sorry vbe i didn't mean to post after you, i should've refreshed the page
  #7 (permalink)  
Old 08-26-2008
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,546
No problemo,
And I happen also to take my time at answering and forget when I click that there is ellapsed time and other have been faster...
And more solutions are given and more choices for a newby to learn and see what is best it different situations...
All the best
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 08:37 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0