2
votes
1answer
35 views

rolling snapshot of pictures taken in the last half hour

I've taken this: find -maxdepth 1 -mtime +1 -type f -exec cp '{}' backup \; Which should copy all the regular files in the current directory more than 1 day old to the directory backup (assuming ...
4
votes
3answers
308 views

Search for specified keywords in files and copy to a new filename based on the keyword

I'm trying to create an .sh script where if any keyword is found in a file then copy that file to the directory /pathtofolder/keywords/$thefirstkeywordfound (overwrite the file if it already exists). ...
0
votes
2answers
890 views

copy files modified after specific date using cp switches

When I execute the command find . -mtime -60 I get the list of files modified within the last 60 days. So when I execute find . -mtime -60 -exec cp {} /tmp/1 \; I can copy these files to a new ...
0
votes
1answer
78 views

Finding a specific file in several sub-directories

I've the following problem : I have to write something to copy a file contained in directory A. The file is unique, and has a specific extension (.jil). Only problem, directory A can contains a ...
1
vote
1answer
147 views

Copying wallpaper images into a single folder

In my ubuntu 12.04 set-up, there are lots of wallpaper images in the directory /usr/share/wallpapers. For example, one might be usr/share/wallpapers/Leafs_Labyrinth/contents/images/1600x1200.jpg ...
2
votes
3answers
238 views

How to copy a list of files and adjust destination filenames on the fly?

When I don't need to adjust destination filenames I can do something like this: $ find -type f -name '*.pat' -print0 | xargs -O cp -t /path/to/dest It is safe because the filenames may even ...
2
votes
3answers
402 views

Use find + sed + cp to find files and copy them to a directory with a different name

I'm trying to copy a bunch of files named folder.jpg into a folder. The problem is because all the files are named the same thing, I need to rename them in the process. I know I can probably do it ...
2
votes
2answers
598 views

How to copy a piped list of files contained spaces and apostrophes?

I have a list of files generated using find that I want to feed (pipe) to cp. My problem is that the files have spaces and apostrophes in them, leading cp to repeatedly complain that it "cannot stat". ...
3
votes
6answers
818 views

Make directory copies using find

I have a directory with a bunch of subdirectories in it. Thus /usr/local/src/ccl/ccl-1.8/x86-headers$ ls elf gl gmp gnome2 gtk2 jni libc Each of these directories has a further subdirectory C ...
4
votes
2answers
4k views

issue with find -exec cp

Consider this example (newbie alert): touch test0 touch timestamp touch test1 sudo find /var/www/import -iname 'test*' -newer timestamp -exec cp {} new \; It actually copies file test1, but it ...
3
votes
1answer
280 views

Copy files in different subdirectories that excludes a string

I'm trying to copy all files of a type in a given directory and subdirectories but excluding files of a different type. find /var/ftp/pub/bs -iname "*foo*.foo" -exec cp {} /var/ftp/pub/bs1 \; ...
5
votes
3answers
2k views

recursively copy only images and preserve path

I'm working on a website migration. I have a scrape of the site, with all the files and directory structure as you would see them in the URL. I want to pull all images, maintaining the directory ...
6
votes
5answers
4k views

How to copy all html files from a directory tree to a single directory?

I want to copy all the .html files in myDir and its subdirectories to ~/otherDir. Here's what I tried (it doesn't work): $ find myDir -name *.html -print | xargs -0 cp ~/otherDir usage: cp [-R [-H | ...