Sponsored Content
Top Forums Shell Programming and Scripting Moving files only by oldest file one at a time Post 302643853 by Chubler_XL on Sunday 20th of May 2012 09:35:31 PM
Old 05-20-2012
How about something like this :

Code:
ls -rt | while read file
do
    if [ -f "$file" ]
    then
        # Process file HERE
        mv "$file" ./transfer
    fi
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Oldest files

Anyone know of a way to list all of the files including subdirectories and list them as oldest first? (2 Replies)
Discussion started by: 2dumb
2 Replies

2. Shell Programming and Scripting

Finding & Moving Oldest File by Parsing/Sorting Date Info in File Names

I'm trying to write a script that will look in an /exports folder for the oldest export file and move it to a /staging folder. "Oldest" in this case is actually determined by date information embedded in the file names themselves. Also, the script should only move a file from /exports to... (6 Replies)
Discussion started by: nikosey
6 Replies

3. Shell Programming and Scripting

Finding files older than the current date and time and renaming and moving

Hi, I have a very urgent requirement here. I have to find all files in the specified directory but not in the sub directories(The directory name is stored in a variable) which are older than the current date as well as current time and rename it as filename_yyyymmddhhmmss.ext and move it into a... (7 Replies)
Discussion started by: ragavhere
7 Replies

4. Shell Programming and Scripting

Moving files which are generating time to time

Hi all, I always getting great response from this forum, that why i am putting again.... I am working in a company which is giving ATM support.In one of my production server a lot of files are getting generated every day. I want to move these files to another name. The file name which is... (4 Replies)
Discussion started by: Renjesh
4 Replies

5. Shell Programming and Scripting

Moving the files based on count and time.

Hi, I have a requirement ,let us say 1000 files needs to be transferred in an hour from one path to another path and if the files (1000 files) are transferred within an hour ( say 40 mins), then the process should remain idle for the remaining time ( 20 mins). (3 Replies)
Discussion started by: Asaikarthik
3 Replies

6. UNIX for Dummies Questions & Answers

To delete the oldest files in a file when file count in the folder exceeds 7

Hi All, I need to delete the oldest file in folder when the file count in the folder exceed 6 ( i have a process that puts the source files into this folder ) E.x : Folder : /data/opt/backup 01/01/2012 a.txt 01/02/2012 b.txt ... (1 Reply)
Discussion started by: akshay01987
1 Replies

7. Shell Programming and Scripting

Keeping oldest backup files?

I need a script to clean up the files on our backup system. I was hoping this would be simple for someone to put together for me. I'm sure I could do it, but I'm a bash n00b so it would definitely not be efficiently or within a reasonable amount of time. :( Requirements: - Root of backups... (3 Replies)
Discussion started by: Calab
3 Replies

8. Shell Programming and Scripting

Moving files based on file name

Hi All, I have multiple files in the folder, I want to move those files into the other folder on based of name File names: Template_server1_01==> Template_server1_02==>To one directory /Server1 Template_server1_03==> Template_server2_01==> Template_server2_02==>To one... (9 Replies)
Discussion started by: sharsour
9 Replies

9. UNIX for Advanced & Expert Users

Finding oldest files

There are some 25,000 files in 7,000 directories in my source library and I am trying to find oldest files. I am running this find: find /usr/mysrc -name "*." -type f -mtime +8000 -exec ls -l {} 2>/dev/null and playing with the days parameter for mtime, but the output is not sorted... (3 Replies)
Discussion started by: migurus
3 Replies

10. Shell Programming and Scripting

Delete 3 oldest files

Trying to delete my 3 oldest files. I am learning despite the many questions. This shows the files. ls -1r /media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/Ubuntu_Documents.zip_* | tail -n+6adding this on did not work. | -exec rm {}------ Post updated at 05:43 PM ------ This works, but I... (15 Replies)
Discussion started by: drew77
15 Replies
uio(9s) 																   uio(9s)

NAME
uio - General: Describes I/O, either single vector or multiple vectors SYNOPSIS
----------------------------- Member Name Data Type ----------------------------- uio_iov struct iovec * uio_iovcnt int uio_offset off_t uio_segflg enum uio_seg uio_resid int uio_rw enum uio_rw ----------------------------- MEMBERS
Specifies a pointer to the first iovec structure. The iovec structure has two members: one that specifies the address of the segment and another that specifies the size of the segment. The system allocates contiguous iovec structures for a given transfer. Specifies the num- ber of iovec structures for this transfer. Specifies the offset within the file. Specifies the segment type. This member can be set to one of the following values: UIO_USERSPACE (the segment is from the user data space), UIO_SYSSPACE (the segment is from the system space), or UIO_USERISPACE (the segment is from the user I space). Specifies the number of bytes that still need to be transferred. Specifies whether the transfer is a read or a write. This member is set by read and write system calls according to the corresponding field in the file descriptor. This member can be set to one of the following values: UIO_READ (read transfer), UIO_WRITE (write transfer), or UIO_AIORW (Alpha I/O read/write transfer). DESCRIPTION
The uio data structure describes, either singler-vector or multiple-vector I/O. Typically, kernel modules do not manipulate the members of this data structure. However, the data structure is presented here for the purpose of understanding the uiomove routine, which operates on the members of the uio structure. FILES
SEE ALSO
Routines: uiomove(9r) uio(9s)
All times are GMT -4. The time now is 11:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy