Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to archive old files from the recently added 10 files? Post 302728951 by DSIReady on Thursday 8th of November 2012 07:28:03 PM
Old 11-08-2012
Question How to archive old files from the recently added 10 files?

Hi there, I am very new to unix and having trouble with a fairly simple statement:

Code:
 
cd /user
ls -t -c1 | sed -ne '11,$p' | mv xargs archive/


What I want the code to do is sort all files in a directory by timestamp, select all of the files after the 10th file, and then move those files to an /archive folder.

When I execute this statement it throws a "file not found" error, is there any obvious reason why this isnt working?

Thanks
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

chmod command for recently modified files

hello! is there a way for me to use the chmod command to change permissions for several files all at once -based on the fact that these files were all most recently modified TODAY ? I can't use a wildcard on their filenames because the filenames are varied. But I was hoping I could somehow do... (2 Replies)
Discussion started by: polka_friend
2 Replies

2. 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

3. UNIX for Dummies Questions & Answers

recently updated files

How do I find files those have been updated in the last 24 hours, sort them by size descending and then display the top of the long list? (6 Replies)
Discussion started by: shantanuo
6 Replies

4. UNIX for Dummies Questions & Answers

Find recently changed files

Hi, Can you guys tell me how do i find the most recently changed files, say an hour before, few hours before, a day before etc.... Thanks!!!! (3 Replies)
Discussion started by: raghu_shekar
3 Replies

5. Shell Programming and Scripting

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... (2 Replies)
Discussion started by: javeiregh
2 Replies

6. Shell Programming and Scripting

how to delete the older files other than the recently added 5 files

Number of files will get created in a folder automatically daily.. so i hav to delete the older files other than the recently added 5 files.. Could u help me through this..?? (5 Replies)
Discussion started by: shaal89
5 Replies

7. UNIX for Advanced & Expert Users

List all files in subdirectories which are modifiled recently.

Hello, I wanted to list all files in subdirectories which are modifiled recently. need to display all files with full details like hpw it display with ls -l ( date, size,..) Thanks Bala (3 Replies)
Discussion started by: balareddy
3 Replies

8. 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

9. 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

10. Shell Programming and Scripting

Check files and archive the files using sftp

Hi, I have to check the files in another server using sftp to do that, below is the code i am going with #!/bin/bash export SRC_FOLDER=$1 export ARC_FOLDER=$2 HOST=as07u3456 USER=relfag sftp ${USER}@${HOST} <<EOF cd $SRC_FOLDER/DSCOR ls bye EOF echo "done" whatever the files i... (8 Replies)
Discussion started by: ursrami
8 Replies
ar86(1) 						      General Commands Manual							   ar86(1)

NAME
ar86 - Create, modify, and extract from archive file SYNOPSIS
ar86 operation archive [file...] ar86 positional-op member archive [file...] DESCRIPTION
The ar86 program is used to create, examine and modify archive files produced by the Dev86/ELKS toolchain. OPTIONS
The ar86 command requires that the operation to be performed on the archive be specified as the first option. If the operation is positional then the next option is the archive member marking the position. This is followed by the archive file name and any list of file names. Operations One of the following operations can be specified d delete the listed files from the archive. m move the named files. By default files are moved to the end of the archive unless a positional modifier is present. p print the contents of archive members to standard out. If a file list is included only those members are printed. If the v modifier is present each file's contents are preceeded by a new line, a line with the string member, a space character, the member name, and two following newlines. q quickly add the files to the end of the archive without checking to see if they already exist in the archive. This operation will ignore any positional modifiers. Creates the archive file if it does not exist. r replace archive members with the files listed. If the file name is not present in the archive it is added to the end of the archive (or to any explicitly specified position). Creates the archive file if it does not exist. t table; list the file names of archive members. If a file list is present only those files that are present in the archive are listed. The v modifier prints member attributes. x extract the named files from the archive into the current directory. If no files are specified all the archive members will be extracted. Modifiers The following modifiers may be used with the operations o original time stamps from the archive are preserved for extracted files when possible. s symbol update; this option may be used by itself to force an update to the symbol definition section of the archive (the __.SYMDEF member). If any files are specified they will be replaced as if the r operation had been specified. If no symbol definition section exists one is created. This option will also creates the archive file if it does not exist. u update files in the archive during a r (replace) operation. The files are added to the archive in exactly the same manner as replace except that an existing archive member will be retained (in its original position) if it has a modified more recently than the file being added. Note that this modifier acts as if a r operation has been specified (even it has not), and will actually override any other previously specified operation. v verbose; print additional diagnostic messages while processing the archive. Positional Modifiers The following modifiers specify where in the archive files are moved to or added. If any of these modifiers are specified then the second option to ar86 must be the name of an archive member. a after; files are placed after the specified archive member. b before; files are placed before the specified archive member. i same as b. EXAMPLES
To see the contents of an archive ar86 tv libfile.a To add some files to an archive ar86 r libfile.a file1.o file2.o to add some files after a member named mem.o and to update the symbol table ar86 rsa mem.o libfile.a file1.o file2.o BUGS
A l modifier will be accepted but ignored. RESTRICTIONS
This command is intended for use only with object files created using the Dev86/ELKS toolchain. SEE ALSO
as86(1), bcc(1), ld86(1) AUTHORS
(C) 1988, 1990 Free Software Foundation Inc. Changes for ar86 by Greg Haerr <greg@censoft.com>. COPYRIGHT
The manual page was written for Debian GNU/Linux, (C) 2006 Shyamal Prasad <shyamal@member.fsf.org>. It is distributed under the terms of the GNU General Public License version 2 (or any later version released by the Free Software Foundation). May, 2006 ar86(1)
All times are GMT -4. The time now is 05:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy