how to copy current date files to another dir


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to copy current date files to another dir
# 1  
Old 08-20-2012
how to copy current date files to another dir

i have directory /abcd and i want to copy all today date files in /xyz directory.


i am able to see the files by using below command but not able to understand copy.

Code:
find . -mtime -1  -type f -exec ls -l {} \;

# 2  
Old 08-20-2012
Code:
find /abcd -mtime -1  -type f -exec cp {} /xyz/ \;

This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 08-20-2012
Thanks @jim mcnamara
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Save all the file of current date in another dir?

Hi i want to copy all the files of current date in another directory. for example, below i want to save all the file of 26 march to copied in debug dir. $ ls -lrt | tail -5 -rwxrwxrwx 1 khare guest 73 Jan 6 12:35 chk -rw-r--r-- 1 khare guest 770 Mar 26 02:21 cc1... (2 Replies)
Discussion started by: scriptor
2 Replies

2. Shell Programming and Scripting

Copy files to a dir using from a list

Hi all, I'd very grateful for some help with the following: I have a directory with several subdirectories with files in them. All files are named different, even between different subdirectories. I also have a list with some of those file names in a txt file (without the path, just the file... (5 Replies)
Discussion started by: foracoffee
5 Replies

3. Shell Programming and Scripting

files copy to dir

Hi, I have a directory which is having many files. I want to copy 10files at a time to another directory. For example. First 10 files to one directory, then next 10 files to another directory and so on. Please let me know if any work around there for it. Thanks (4 Replies)
Discussion started by: Anjan1
4 Replies

4. Shell Programming and Scripting

Copy files and subdirs from dir to a new dir

Hello Comunity I am trying to make a bash shell script that it copies files and subdirs(with files) to a new dir. I would like the dest_dir to contain only subdirectories with files not other subdirs inside. it called : cpflatdir src_dir dest_dir Pleaze help me! Thank you in... (2 Replies)
Discussion started by: BTKBaaMMM
2 Replies

5. UNIX and Linux Applications

CPIO Problem, copy to the root dir / instead of current dir

HI all, I got a CPIO archive that contains a unix filesystem that I try to extract, but it extract to the root dir / unstead of current dir, and happily it detects my file are newer otherwise it would have overwrited my system's file! I tried all these commands cpio -i --make-directories <... (2 Replies)
Discussion started by: nekkro-kvlt
2 Replies

6. Shell Programming and Scripting

How to create a dir with name "current date".

I need to create a dir in my script with its name as current date in the server. how can i do that please help. (2 Replies)
Discussion started by: abhishek27
2 Replies

7. Shell Programming and Scripting

How to copy specified files from list of files from dir A to dir B

Hello, fjalkdsjfkldsajflkajdskl (3 Replies)
Discussion started by: pmeesara
3 Replies

8. UNIX for Dummies Questions & Answers

script to rename files with current date and copy it.

I have few webservers logs like access.log. which would be growing everyday. what i do everyday is, take the backup of access.log as access.log_(currentdate) and nullify the access.log. So thought of writing a script... but stuck up in middle. My requirement: to take the backup and nullify... (6 Replies)
Discussion started by: logic0
6 Replies

9. Shell Programming and Scripting

copy files from one dir to another

Hi , I want to copy files from one dir to anothe dir and check if destination dir exists ,if not exist ,has to create but when executing the below schell script ,the destination directory not exist and exit the shell script. #!/bin/sh src_path=/home/owngdw/abc tgt_path=/home/owngdw/abc/xyz if... (6 Replies)
Discussion started by: mohan705
6 Replies

10. UNIX for Dummies Questions & Answers

How to copy N files from one dir to another

Hi, I have a script that can only handLE limited number of input files. I need to be able to write a command (or a script) that: 1> copies N number of files from one directory (A) to another (B). 2> Files that are moved need to be renamed. 3> Files picked to be moved have... (1 Reply)
Discussion started by: GMMike
1 Replies
Login or Register to Ask a Question