General :: Find And Copy In The Same Directory
Sep 1, 2010
I installed a new music application. It reads covers.jpg as the cover of the album, however, my covers files where named album. I dont want to rename, I want to make a copy of album.jpg and if possible as well rename it to covers.jpg. The file has to be in the same folder that it currently is. I have looked around to see how I can do this but have not been able to.
View 14 Replies
ADVERTISEMENT
Nov 7, 2010
This is a bit of a basic question but I'm trying to copy all .doc files I find in a directory and copy them to another directory.I know each command:
find -name '*.doc' .
and:
cp filename location
how can I combine the two commands?
View 3 Replies
View Related
Nov 18, 2010
This question is very similar to this one except that I want to maintain the file's original subdirectories.
For example if I had
/temp/a/a.txt
/temp/a/a.jpg
/temp/a/b.txt
/temp/b/c.txt
/temp/d/d.txt
/temp/d/d.jpg
/temp/d/e.txt
/temp/f.txt
[Code]...
View 2 Replies
View Related
Feb 17, 2011
I have a number of crash.log files scattered about my system and I would like to run a command to find all the crash.log files on the system and copy them to a single directory; each with a unique filename. For example, copy crash.log from ~/directory_1 , ~/directory_2 , ~/directory_3 and so on to ~/crash_logs/crash.log1 , ~/crash_logs/crash.log2 , ~/crash_logs/crash.log3 etc.
View 1 Replies
View Related
May 13, 2011
I am in my current directory. I want to copy a directory somewhere else into this current directory. Lets say I want to take it from direc1/direc2 and the directory I want to take is called demo.
Code:
That is what it shows in the man pages, but when I do that, it says cp: no match
View 5 Replies
View Related
Jul 13, 2011
I'm quite new to linux but I have configured a simple ftp server and it's working great. I have a FTP-Shared folder with upload and download subfolders. Under upload's and download's I have identical category subfolders like mp3's, movies, software etc. in both. As the guy's upload, I would like to create a line crontab where I can move all the content under /FTP-Shared/upload/mp3/* older than 14 day's to FTP-Shared/downloads/mp3/ recursively (Like in cp command), but the timestamp must be searched on the first directory and not sub files example: /mp3/Club Dance/CD1/Hallo world.mp3This is how far I got:[root@clients ~]# /usr/bin/find /FTP_Shared/upload/Mp3s/ -depth -mindepth 1 -mtime +14 -type d -exec mv -f {} /FTP_Shared/download/Mp3s/ ;This command moves the directory and files, but it is not recursively
View 4 Replies
View Related
May 26, 2010
Why can't I copy a directory without using -R ? It shows "cp: omitting directory" .
View 3 Replies
View Related
Mar 18, 2010
I am using my media server as my podcast collector. I am in the process of learning the ins and outs of NFS so i can mount a NFS directory and transfer my podcasts from server to player. For now i am using scp to transfer podcasts from server to desktop then to player. The problem is the path to the directory of one of the podcasts is /home/user/gpodder-downloads/The BILL&TIMMY Show Podcast.
whenever i try and run my scp command it fails because it thinks that TIMMY is a script i want to run in the background. I have tried to back-slash escape the character, i've tried single quoting and double quoting the character and i still get the same problem. as it sits now i have to move all podcasts to another directory and then transfer them to my desktop...but i would like to transfer the podcasts without un-necessary steps.
View 8 Replies
View Related
Apr 25, 2011
I moved to Mac OS X recently and bumped into the "feature" of Mac where copying files from an external drive resets the file modification/update date/timestamp to the current date (which Windows does not), causing a disaster for my 10+ years of backup work files where date is important. So, before I learned how to avoid that (e.g. using the -p "preserve" flag in the "cp" copy command) I have in the meantime added to my new Mac hard drive many more files as well as updating existing old files.
I have a backup external hard drive with all my old data and proper modification dates. I have a Mac hard drive with reset modification file dates (a single or two particular days). The Mac hard drive has all the "true" and "current" file contents with files modified and added. I need to Copy all the original files from the external harddrive, preserving file metadata (really only modified date), but ONLY overriding the new internal Mac hard drive IF
The file contents (md5 or whatever) is the same or The file was updated after the day (which of course I can see on all files) on which the original disasterous cope was performed (implying the file is new or modified) Ensure the copy leaves all the new and modified files completely intact on the Mac internal hard drive. "No prompting/stopping of the copy of any kind (i.e., not verbose) is required but is o.k". "Recursive copy - obviously I would like to copy all* files folders and subfolders found in export".
View 1 Replies
View Related
Jul 7, 2011
I would like to copy the contents of a directory into another. I don't want to copy the directory and all files and directories under it, but just the contents of the directory just as if it were a regular file. Doing cp -r target dest copies the directory and the entire hierarchy rooted in it. I get error if I do not include the -r option. (I am calling cp from within a C program.)
View 3 Replies
View Related
Oct 28, 2010
I have this scripts that is meant to create certain files and a directory by date and once its finished its meant to copy that direcory an the example ftp server.
View 1 Replies
View Related
Nov 5, 2009
Is there a way to copy a directory (retaining the permissions and owners) without copying the contents of the directory?
If there is no such thing... then I need a way to determine if a target path is a file or a directory, and if it is a directory I need to make a new directory elsewhere that has the same name, owner and permissions.
Basically, I'm trying write a script to copy 200 GB of files over a network to a new server, and I'd like to do it by generating a list with the find command. That way, I can migrate large chunks of the files over the course of a week, and on the day of the migration generate a new list of files that changed in the last week and then copy just the chagned files over minimizing the down time. However, the list will contain directories that I can't just use the 'cp' command on because it will copy all the contents of the directory.
View 5 Replies
View Related
Dec 22, 2009
I have four directories and i want to copy only the files in the directory to a single directory, how can i do it with the cp command.
The directories names are dir1, dir2, dir3 and dir4 and i want only the files from these directories to a single directory called mainDir.
View 3 Replies
View Related
Aug 25, 2010
How Can I Copy Everything in Current Directory to Subdirectory in linux console
View 6 Replies
View Related
May 23, 2011
I have a system where the permissions of many files are messed up. I have another system that has the same files, if I put that hard drive in, without simply overwriting the files, is there a way where I can recursively set the permissions of each file to that of this other directory?
View 1 Replies
View Related
Sep 4, 2009
i've been getting into problems trying to move around my partitions, by copying them to a directory on a partitions with alot of extra space, then mounting then with --bind. i think it's todo with the permissions, like i can run gdm for the gui but i can't login.startx doesn't work though, gives me some errors but i don't know alot about x windows. but like the partitions are mounted, but just the system doesn't work properly with them this way?this is my method
Code:
rsync -aHPvx /usr/ /store/usr_proxy
then in fstab
Code:
/store/usr_proxy /usr ext3 bind,defaults 0 0
View 2 Replies
View Related
Aug 4, 2011
How to copy a file from remote to local directory and vice versa using ftp bat script file in telnet.
View 1 Replies
View Related
Apr 16, 2010
i just need to make copy files have 2 year old to another directory i know how to use cp command but i am not able to do that
View 2 Replies
View Related
Jul 27, 2011
I am trying to read mulitple files and copy its contents (files) to a respective directory. I have a folder "Oracle". Under this i have mulitple files as mentioned below.
Each of the above has a list of files in them.
Now i have created new directories with the same name as the above files in another location say
The script that i looking at has to read the files from Oracle, backup its contents to its appropriate new directory.
Example:
View 2 Replies
View Related
Mar 29, 2010
I want to know how to copy a range of files from one directory to another.
For example say I list the contents of a directory, how would i copy files 5-15 to another directory?
View 3 Replies
View Related
Apr 15, 2011
Is it possible to copy files from directory of one user to directory of another user in linux?
View 7 Replies
View Related
Feb 3, 2011
I have directory a and directory b. They are big. b is almost identical to a. "almost" means that 4-5 files differ, and I don't know which they are. I want to copy b over a, but only the files that differ. i'm in bash.(no, I can't simply delete a and replace it with b, because 1) a is version-controlled 2) a full copy (or a mv) would take too much. I want to copy only the files that differ).
View 4 Replies
View Related
Mar 4, 2011
I have a directory containing a lot of result log files (directory size ~ 4GB), and a set of processes running that keep on writing to these files. To be able to correctly analyze the results at a later time, I want to copy the whole directory to an archive destination, and I cannot stop the processes.
I want a copy of the directory as it was at a particular point of time. As the size directory is huge (which means it takes about 40 seconds to copy) and some of the files are being written to, a normal cp -r does NOT give me a snapshot at a particular point in time, rather a snapshot of files spread over some 40 seconds. This is not good enough.
Is there a way to get an exclusive lock on the directory and all its components while copying?
View 5 Replies
View Related
Jul 20, 2011
I would like to find the command that copy my eclipse options to another workspace code...
It doesn't work, and it could be source of error to write the path .metadata/.plugins manually. It certainly a better idea to create a complete script ?
View 1 Replies
View Related
Apr 10, 2010
I have a WD world book edition 1TB NAS drive, and just purchased an acomdata 1tb drive and connected it to the NAS via USB. If I recall I think the WD NAS has a ext_ or some type of linux filesystem on it, and the acomdata has a ntfs filesystem on it.
What I want to do is copy over certain directory trees of the NAS to the USB attached drive. I usually use MS synctoy to sync folders from my windows pc to the NAS drive, and MS richcopy to make the initial transfer from PC to NAS. For this operation though, since it is taking place entirely on the NAS and its connected drive, I thought that rsync would be the best option, and it is available on my NAS drive.
Last night I entered in rsync -avr /movies/* /usb1-1share1/ to copy the entire "movies" dir to the drive, which shows up as usb1-1share1 on the NAS drive. It copied most of the directory tree ok, but a lot of the folders were empty, so this morning I tried rsync -Carv --ignore-existing /movies/* /usb1-1share1/ to try and get all the files missed, without recopying the 24GB that did make it across. This also managed to copy a few more GB over, but not everything.
I am running the command from an ssh session on the NAS using putty on my PC, in as user "admin" which should have all rights over these folders. There is a bunch of errors in the command window like this: rsync: failed to set times on "/shares/usb1-1share1/movies/classics/fulldvd/First Blood DVD/.VTS_01_2.VOB.RxdjWZ": Operation not permitted (1)
I want to restart another session and get the files it missed, but I want to find out what I am doing wrong first. Should I be doing this as root user? am I missing some switches or just plain doing it all wrong?
View 3 Replies
View Related
May 3, 2011
I've created other users in my machine. now I want to add all my home directory contents and settings to the home directory of other users. how can i do that? Can I do it from /etc/skel directory?
View 1 Replies
View Related
Apr 20, 2011
I was trying to develop a script which needs to check the count of files on hourly basis and if it find any addition it has to sftp and send a email on the status with filenames and number of files copied via sftp. I will put it on cron to run every hour.
I'll use ls /abc|wc -l to count the no. of lines for the first time and from then whenever a new file will be inserted it'll copy that file to another location or I'll take the date of the files and whichever is having a new date that will be copied to another location.
View 7 Replies
View Related
Jun 11, 2011
How do you copy everything in the home directory to an external drive while running in rescue mode?
View 3 Replies
View Related
Mar 3, 2011
What is the correct way to copy a file or directory to another directory? In the past I was able to use press the mouse left and right button, it didn't work all the time hard to press the two buttons at the same time. With the Fedora 14 it does not work at all.
View 3 Replies
View Related
Oct 25, 2010
Newbie 1st post here. Trying to find the most efficient way to copy a file to a different directory and rename it with a date stamp extension. Looking to accomplish this with one command if possible.
File = make_file
Full path /home/user1/bin/scripts/make_file
would like to move to the following directory /home/user1/bin/scripts/archive/
I'm trying to find out how to use command substitution along with the date command that when I copy the file to the archive directory it gets renamed with a time stamp extension. It should look something like "make_page_12:00:00-24-10-2010" I've tried a few different combinations using the cp and mv commands but can't seem to get it to work the way I want to.
View 3 Replies
View Related