Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Copy files in order of creation date Post 303004363 by Yoda on Saturday 30th of September 2017 11:54:02 AM
Old 09-30-2017
Note that -t switch does not sort by creation time, it perform sort by modification time
Code:
       -t     sort by modification time

You can use stat to perform this task:-
Code:
stat -c '%Y %n' * | sort -n | while read mtime file; do cp "$file" ./destination/; done

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Moving files based on creation date

Howdy, I'm trying to figure out how to move multiple files based on their creation date. If anyone can enlighten me it would be most appreciated!! Thanks! :D (1 Reply)
Discussion started by: dgoyea
1 Replies

2. UNIX for Dummies Questions & Answers

list of files in date order

Im on HP/UX and am trying to find the command like an ll but that will sort showing the most currently modified programs first. Can anyone help me with that? :cool: (2 Replies)
Discussion started by: Jeannine
2 Replies

3. UNIX for Dummies Questions & Answers

How do I organize a series of files in date order?

I'd like to ls a group of files in date order but I'm not sure what the commands would be. Can anyone help with this? (1 Reply)
Discussion started by: hedgehog001
1 Replies

4. Shell Programming and Scripting

Order files by create date

hi Is there a way to sort files in the order they were created ,and move them to another directory one by one ,oldest being the first to be moved. Thanks Arif (4 Replies)
Discussion started by: mab_arif16
4 Replies

5. Shell Programming and Scripting

Sorting Files by date and moving files in date order

I need to build a k shell script that will sort files in a directory where files appear like this "XXXX_2008021213.DAT. I need to sort by date in the filename and then move files by individual date to a working folder. concatenate the files in the working folder then start a process once... (2 Replies)
Discussion started by: rebel64
2 Replies

6. UNIX for Dummies Questions & Answers

Renaming files by changing date order

I'm looking for a simple solution to rename a batch of files. All of the files in this directory start with a date in the format mm.dd.yy followed by a space and then additional descriptive text. Example: 01.21.10 742 P.xlsx 02.24.09 730 Smith.xlsx The information following the date can... (3 Replies)
Discussion started by: kreisel
3 Replies

7. Shell Programming and Scripting

copy files based on creation timestamp

Dear friends.. I have the below listing of files under a directory in unix -rw-r--r-- 1 abc abc 263349631 Jun 1 11:18 CDLD_20110603032055.xml -rw-r--r-- 1 abc abc 267918241 Jun 1 11:21 CDLD_20110603032104.xml -rw-r--r-- 1 abc abc 257672513 Jun 3 10:41... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

8. Shell Programming and Scripting

Script to copy creation date over top of modified date?

Can someone draw up a script that for every file, folder and subfolder and files that will copy the creation date over top of the modified date?? I know how to touch every file recursively, but no idea how to read a files creation date then use that to touch the modification date of that file,... (3 Replies)
Discussion started by: toysareforboys
3 Replies

9. Shell Programming and Scripting

Bash directory loop and order by creation date?

Hello, how in bash i can get directory loop and order by creation date? THX! :) #!/bin/bash for folder in /home/test/* do if ; then echo $folder; fi (12 Replies)
Discussion started by: ZerO13
12 Replies
MKFS(8) 						      System Manager's Manual							   MKFS(8)

NAME
mkfs, mkext - archive or update a file system SYNOPSIS
disk/mkfs [-aprv] [-n name] [-s source] [-u users] [-z n] proto ... disk/mkext [-d name] [-u] [-h] [-v] file ... DESCRIPTION
Mkfs copies files from the file tree source (default /) to a kfs file system (see kfs(4)). The kfs service is mounted on /n/kfs, and /adm/users is copied to /n/kfs/adm/users. The proto files are read, and any files specified in them that are out of date are copied to /n/kfs. Each line of the proto file specifies a file to copy. Indentation is significant, with each level of indentation corresponding to a level in the file tree. Fields within a line are separated by white space. The first field is the last path element in the destination file tree. The second field specifies the permissions. The third field is the owner of the file, and the fourth is the group owning the file. The fifth field is the name of the file from which to copy; this file is read from the current name space, not the source file tree. All fields except the first are optional. Names beginning with a are expanded as environment variables. If the first file specified in a directory is all of the files in that directory are copied. If the first file is all of the files are copied, and all subdirectories are recursively copied. Mkfs copies only those files that are out of date. Such a file is first copied into a temporary file in the appropriate destination direc- tory and then moved to the destination file. Files in the kfs file system that are not specified in the proto file are not updated and not removed. The options to mkfs are: a Instead of writing to a kfs file system, write an archive file to standard output, suitable for mkext. All files in proto, not just those out of date, are archived. n name Use kfs.name as the name of the kfs service (default kfs). p Update the permissions of a file even if it is up to date. r Copy all files. s source Copy from files rooted at the tree source. u users Copy file users into /adm/users in the new system. v Print the names of all of the files as they are copied. z n Copy files assuming kfs block n (default 1024) bytes long. If a block contains only 0-valued bytes, it is not copied. Mkext unpacks archive files made by the -a option of mkfs. The -d option specifies a directory (default /n/kfs) to serve as the root of the unpacked file system. The -u option, to be used only when initializing a new fs(4) file system, sets the owners of the files created to correspond to those in the archive and restores the modification times of the files. (This is only permitted at the initial load of the files into a file system.) Each file on the command line is unpacked in one pass through the archive. If the file is a directory, all files and subdirectories of that directory are also unpacked. When a file is unpacked, the entire path is created if it does not exist. If no files are specified, the entire archive is unpacked; in this case, missing intermediate directories are not created. The -v option prints the names and sizes of files as they are extracted; -h prints headers for the files on standard output instead of unpacking the files. EXAMPLES
Make an archive to establish a new file system: disk/mkfs -a -u files/adm.users -s dist proto > arch Unpack that archive onto a new file system: srv il!newfs mount -c /srv/il!newfs /n/newfs disk/mkext -u -d /n/newfs < arch FILES
/lib/proto directory of prototype files. /lib/proto/portproto generic prototype file. SOURCE
/sys/src/cmd/disk/mkfs.c /sys/src/cmd/disk/mkext.c SEE ALSO
prep(8), kfscmd(8), wren(3), pip(8) MKFS(8)
All times are GMT -4. The time now is 04:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy