Sponsored Content
Top Forums Shell Programming and Scripting How to recursively copy directory only for recent files? Post 302971097 by siegfried on Friday 15th of April 2016 02:28:52 PM
Old 04-15-2016
How to recursively copy directory only for recent files?

I love the -newerct flag for the Cygwin find command on windows.

Can I use "/usr/bin/find . -newerct '3 hours ago'" to conditionally copy a directory tree so that only the files in the directory tree that are younger than 3 hours are copied to my destination directory such that the directory structure is preserved?

Can someone give me a sample /usr/bin/find command (or some other utility) that will only recreate those parts of the directory tree on a different memory stick that are younger than 3 hours?

Thank you
Siegfried
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Recursively copy only specific files from a directory tree

Hi I am a shell-script newbie and am looking to synchronize certain files in two directory structures. Both these directory-trees are in CVS and so I dont want the CVS directory to be copied over. I want only .sh and .pl files in each subdirectory under these directory trees to be... (3 Replies)
Discussion started by: sharpsharkrocks
3 Replies

2. Shell Programming and Scripting

delete files recursively in the specified directory

I have to write a shell script which can delete all the files and directories recursively inside the specified directory but should not delete the specified directory. Please some body help me in writing the script. (3 Replies)
Discussion started by: deepthi.s
3 Replies

3. Shell Programming and Scripting

Recursively search for most recent modification

Hello all, I'm trying to determine when the last time a file in a certain directory was modified. I don't care what file it is, I just want to know when it was last updated. So far I have ls -aRl --full-time --sort=time which is close. The problem is that it only sorts within folders, not... (2 Replies)
Discussion started by: lokisapocalypse
2 Replies

4. Shell Programming and Scripting

Copy only files recursively

Hi, find . | xargs -s 47518 can list all the files and directories recursively , is there any possibility to copy only files from directories and subdirectoreis once it is listed. Please help Thans & Regards Uma (3 Replies)
Discussion started by: umapearl
3 Replies

5. Shell Programming and Scripting

Problem with script generating files in directory recursively

I have a script which generates recursively some files in folders for a given root folder. I have checks for permissions and it works for all folders except one(i have 777 permission on it). When i try calling the script in problematic folder(problematic folder being root folder), script works as... (2 Replies)
Discussion started by: bb2
2 Replies

6. UNIX for Dummies Questions & Answers

Copy files recursively

Hello! I know what i s recursion, but can't imagine what shoudl be "recursicve copying" of files? Please, what should mean: cp -r /home/hope/files/* /home/hope/backup Can someone helpme with a simple example? Many thanks!!! (6 Replies)
Discussion started by: pinklemon
6 Replies

7. UNIX for Dummies Questions & Answers

Find most recent file and copy to another directory.

Very new to shell scripting. Not sure if my title is correct but I will try and explain. Directory has 100+ files with this format, " ABCD_ABC_Abc_AB0126.abc ". When a new file gets created, the 16-19 characters in the file name gets incremented by 1. Ex...todays most recent file is... (14 Replies)
Discussion started by: askvip
14 Replies

8. Shell Programming and Scripting

How to rename (move) most recent files in directory?

I'm using cygwin32 on Windows. DN is an environment variable pointed at my download directory. This command works to move the single most recent file in my download directory to my current directory: mv "`perl -e '$p = $ARGV; opendir $h, $p or die "cannot opendir $p: $!"; @f = sort { -M $a... (2 Replies)
Discussion started by: siegfried
2 Replies

9. Shell Programming and Scripting

Copy Specific Files Recursively

Is it possible to only copy selected files+its directories when you are copying recursively? find /OriginalFolder/* -type -d \{ -mtime 1 -o -mtime 2 \ } -exec cp -R {} /CopyTo/'hostname'__CopyTo/ \; -print From the above line, I want to only copy *txt and *ini files from /OriginalFolder/* ... (4 Replies)
Discussion started by: apacheLinux
4 Replies

10. Shell Programming and Scripting

Copy files recursively to one single directory

I need to copy a complete directory structure into a new location. But I want to have all files copied into one directory and leave out the directory structure. So all files must be placed in one directory. (4 Replies)
Discussion started by: ReneVL
4 Replies
NcdT(1) 						      General Commands Manual							   NcdT(1)

NAME
ncdt - directory tree printer with extended capabilities SYNOPSIS
ncdt [-db?] [--dirs] [--bitrate] [--prefix text ] [--help] [ directory [ name ]] DESCRIPTION
ncdt is a small utility for printing directory trees. It has some additional features not found in tree(1). Additional capabilities are: - size field for directories displays the summary size of directory subtree instead of the size of the special file (which is somewhat more useful) - sizes are displayed in a more readable format (that's a minor improvement, but it helps a little) - MP3 files are detected; additional info is displayed for them (which is probably the nicest thing about NcdT) The info is displayed in a compact form, like <2:53 v168JR+> where 2:53 is play time, v (if present) means the file is encoded using VBR, 168 is bitrate (average bitrate for VBR files), J describes channel encoding (Mono, Stereo, Joint-Stereo, Dual channel), R (if present) means the file has a RIFF header at the beginning, + (if present) means the file has ID3v2 tag attached - (if present) means there's no ID3 tag at all (none of these means there's only ID3v1 tag present). NcdT is particularily nice for indexing CDs. OPTIONS
-d --dirs Print only directories, omit files. This mode is a rough equivalent of du(1). -b --bitrate Print bitrate info for directories. Bitrates are displayed both for ordinary files and directories. If all MP3 files in a given directory subtree have the same bitrate only one number is printed, if they have various bitrates the range is printed. --prefix text Prefix listing with given text. This option is not intended for general use. It might be used by programs using NcdT to index CDsor doing similar operations to record additional information. -? --help Display usage summary. USAGE
When called without any parameters ncdt displays directory tree for current directory (.). When called with one parameter ncdt displays directory tree for specified directory. When called with two parameters ncdt displays directory tree for the directory specified as its first parameter. Second parameter is used as directory label for the top level directory (instead of directory name from parameter 1). EXAMPLES
ncdt prints directory tree for the current directory. It will be labeled . ncdt /usr prints directory tree of /usr. It will be labeled /usr ncdt /cdrom 'CD #21' prints directory tree of /cdrom. It will be labeled CD #21 ncdt -db /cdrom lists directory sizes, play times and bitrate ranges SEE ALSO
tree(1), du(1) BUGS
NcdT uses quite a lot of memory. It's also not very fast, but on a decent CPU it should not be noticeable. There are no real bugs I'm aware of. I don't think there are any now. AUTHOR
Pawel Wiecek <coven@vmh.net> NcdT(1)
All times are GMT -4. The time now is 10:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy