# FTP - Transfer Files according to date time



## Lalita (Jan 29, 2013)

Hi all,
I want to transfer the .PDF files as they are getting scanned. 
1. I will scan the files in the form of PDF.
2. I need to transfer file, according to the order in which they are scanned.
Previously, I was transferring the files using " mput " command but as i have to transfer the file according to date time. I am stuck... 
Please help me....


----------



## foxidrive (Oct 20, 2012)

Show us your script and someone can modify it for you. Just disguise the username/password/server but leave everything else.


----------



## Lalita (Jan 29, 2013)

I am calling the commands.txt file using below command
C:\Putty\psftp user_name server_name -pw password -b C:\Commands.txt > 

Commands.txt contains the below command
mput C:\Folder_Name\*.pdf

Now I am stuck here how to transfer the files according to modified/Created date time.


----------



## Squashman (Apr 4, 2003)

```
pushd "C:\Folder_Name"
for /f "delims=" %%G in ('dir /b /a-d /od *.pdf') do echo mput c:\Folder_name\%%G>>commands.txt
popd
```


----------



## foxidrive (Oct 20, 2012)

Some changes to Squashman's idea - the only necessary thing is the /b in the DIR command.


```
@echo off
set "folder=C:\Folder_Name"
pushd "%folder%" 
del commands.txt 2>nul
for /f "delims=" %%G in ('dir /b /a-d /od *.pdf') do >>commands.txt echo mput %folder%\%%G
popd
```


----------



## Lalita (Jan 29, 2013)

Hi Guys,
Thank you so much............


----------

