subtring and copy recently files and another folder


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting subtring and copy recently files and another folder
# 1  
Old 11-23-2011
subtring and copy recently files and another folder

Hi

I have the following files
A320_ZONAL_v24_-_AMM_Suffix_jess_2011-05-31.xls Jun 10 17:21
A320_ZONAL_v24_-_AMM_Suffix_jess_.xls Nov 10 17:21
A320_ZONAL_v24_-_AMM_Suffix_jess_2011-03-31.xls Nov 23 20:21


And I need only the more recent one using UNIX timestamp (A320_ZONAL_v24_-_AMM_Suffix_jess_2011-03-31.xls Nov 23 20:21) and rename it to "A320_ZONAL"

thanks so much


Moderator's Comments:
Mod Comment Please use code tags!

Last edited by vbe; 11-23-2011 at 02:21 PM..
# 2  
Old 11-23-2011
Have you tried:
Code:
ls -1t A320_ZONAL* | head -1

# 3  
Old 11-24-2011
Thanks Shell

Also I need copy this file in another folder

ls -1t A320_ZONAL* | head -1

por example results is:

A320_ZONAL_Today copy to tmp/dir/ A320_ZONAL_Today
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to copy the two most recently added files to another directory - HP-UX?

Hello, I am attempting to find and copy the two most recently added files to a specific directory, that fit a specific format. I was able to find the command to list the two most recently added files in directory: ls -1t | head -n 2 The command lists the two files names in a vertical list,... (11 Replies)
Discussion started by: mattkoz
11 Replies

2. UNIX for Dummies Questions & Answers

Copy files from one drive to another, keeping most recently modified files

Hi all, I am a bit of a beginner with shell scripting.. What I want to do is merge two drives, for example moving all data from X to Y. If a file in X doesn't exist in Y, it will be moved there. If a file in X also exists in Y, the most recently modified file will be moved to (or kept) in... (5 Replies)
Discussion started by: apocolapse
5 Replies

3. Shell Programming and Scripting

How to copy files with the same filenames as those in another folder to that same folder?

Hello All A similar question like this was asked before but I need to change part of the question. I've two folders, Folder A contains some image files in 150 subfolders; Folder B contains text files in 350 subfolders. All image files in Folder A have the same filename as the text... (5 Replies)
Discussion started by: chlade
5 Replies

4. UNIX for Dummies Questions & Answers

Copy files to folder.

Hi, I have a folder which contains some files like this. bin.000001 bin.000002 bin.000003 bin.000004 bin.000005 bin.000129 bin.index I want to copy all these files to a new folder except the last files. Please provide some ideas. Please use next time code tags for your code... (6 Replies)
Discussion started by: arijitsaha
6 Replies

5. Shell Programming and Scripting

Problem in copy files to a folder

Hi all, cp -r /tmp/Agent/* /apps/opt/Agent/TEST When I copy files under /tmp/Agent using this command Files are getting copied to Agent folder also but I need only in the TEST folder. Is there any way to fix this issue??\ Thanks in advance Ananth (4 Replies)
Discussion started by: Ananthdoss
4 Replies

6. UNIX for Dummies Questions & Answers

How to copy files to one folder?

Hi , I have a file like this, i need to trace its path and copy the files from its path to one folder. I need to replace elib.com,melib.com to F:\.Here i need to copy to a folder called image. Please help http://elib.com/SHC/NLNLHB/020001498.pdf ... (4 Replies)
Discussion started by: umapearl
4 Replies

7. Shell Programming and Scripting

Find all text files in folder and then copy to a new folder

Hi all, *I use Uwin and Cygwin emulator. I´m trying to search for all text files in the current folder (C/Files) and its sub folders using find -depth -name "*.txt" The above command worked for me, but now I would like to copy all found text files to a new folder (C/Files/Text) with ... (4 Replies)
Discussion started by: cgkmal
4 Replies

8. UNIX for Advanced & Expert Users

Auto copy for files from folder to folder upon instant writing

Hello all, I'm trying to accomplish that if a file gets written to folder /path/to/a/ it gets automatically copied into /path/to/b/ the moment its get written. I thought of writing a shell script and cron it that every X amount of minutes it copies these files over but this will not help me... (2 Replies)
Discussion started by: Bashar
2 Replies

9. Shell Programming and Scripting

How to copy one folder to another with existing files

For example, /tmp/folder1 includes /tmp/folder1/a /tmp/folder1/b /tmp/folder2 includes /tmp/c Is there a command without removing files in /tmp/folder2 first to copy the /tmp/folder1 to /tmp/folder2? and the result should be /tmp/folder2 will include only /tmp/folder2/a... (2 Replies)
Discussion started by: lalelle
2 Replies

10. Shell Programming and Scripting

Trying to Copy Files Changed Recently

I have been toying around with a script that will copy all files altered in a development directory over to a testing directory and have been trying to construct the command to meet my needs. Basically I am using find in a directory to see what files have changed over the past 24 hours. Then if... (4 Replies)
Discussion started by: scotbuff
4 Replies
Login or Register to Ask a Question