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
CURLOPT_READFUNCTION(3) 				     curl_easy_setopt options					   CURLOPT_READFUNCTION(3)

NAME
CURLOPT_READFUNCTION - read callback for data uploads SYNOPSIS
#include <curl/curl.h> size_t read_callback(char *buffer, size_t size, size_t nitems, void *instream); CURLcode curl_easy_setopt(CURL *handle, CURLOPT_READFUNCTION, read_callback); DESCRIPTION
Pass a pointer to your callback function, as the prototype shows above. This callback function gets called by libcurl as soon as it needs to read data in order to send it to the peer - like if you ask it to upload or post data to the server. The data area pointed at by the pointer buffer should be filled up with at most size multiplied with nmemb number of bytes by your function. Your function must then return the actual number of bytes that it stored in that memory area. Returning 0 will signal end-of-file to the library and cause it to stop the current transfer. If you stop the current transfer by returning 0 "pre-maturely" (i.e before the server expected it, like when you've said you will upload N bytes and you upload less than N bytes), you may experience that the server "hangs" waiting for the rest of the data that won't come. The read callback may return CURL_READFUNC_ABORT to stop the current operation immediately, resulting in a CURLE_ABORTED_BY_CALLBACK error code from the transfer. The callback can return CURL_READFUNC_PAUSE to cause reading from this connection to pause. See curl_easy_pause(3) for further details. Bugs: when doing TFTP uploads, you must return the exact amount of data that the callback wants, or it will be considered the final packet by the server end and the transfer will end there. If you set this callback pointer to NULL, or don't set it at all, the default internal read function will be used. It is doing an fread() on the FILE * userdata set with CURLOPT_READDATA(3). DEFAULT
The default internal read callback is fread(). PROTOCOLS
This is used for all protocols when doing uploads. EXAMPLE
Here's an example setting a read callback for reading that to upload to an FTP site: https://curl.haxx.se/libcurl/c/ftpupload.html AVAILABILITY
CURL_READFUNC_PAUSE return code was added in 7.18.0 and CURL_READFUNC_ABORT was added in 7.12.1. RETURN VALUE
This will return CURLE_OK. SEE ALSO
CURLOPT_READDATA(3), CURLOPT_WRITEFUNCTION(3), CURLOPT_SEEKFUNCTION(3), CURLOPT_UPLOAD(3), CURLOPT_POST(3), libcurl 7.54.0 February 03, 2016 CURLOPT_READFUNCTION(3)
All times are GMT -4. The time now is 01:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy