Jump to content

Recommended Posts

Posted

This is a simple script designed to fulfil a request. It was intented to work as an alternative way to back up certain types of files by date.

It will: detect a specified file type, rename the file(s) to their creation date, then move them from a source directory to a destination directory.

It can be used through a command line with the specified arguments only.

Example Syntax:

COMPILED: scriptname.exe <source> <destination> <filetype>

RAW: autoit3.exe <script location\name.au3> <source> <destination> <filetype>

timebch.zip

Posted

Chaos945,

Nice script. I had to make two modifications in the code to make it work. I have attached the revised code so you can see and verify my changes. This code is quite useful.

Thanks

P.S. I added the Screen Shots of the error encountered..

Posted (edited)

Are you sure you're using the latest version of AutoIt? The two modifications both relate to fairly newish changes to AutoIt (namely, the = 1 thing on the -ArrayInsert function is an optional parameter, and the third parameter on FileGetTime is the return type of FileGetTime.)

Edited by Chris_1013
Posted

Are you sure you're using the latest version of AutoIt? The two modifications both relate to fairly newish changes to AutoIt (namely, the = 1 thing on the -ArrayInsert function is an optional parameter, and the third parameter on FileGetTime is the return type of FileGetTime.)

<{POST_SNAPBACK}>

You got me there! I was running the previous version 3.0.102. I did upgrade to the 3.1.0 version and all is well. I guess it has been a while since I did the last upgrade.

Thanks for the heads up..

-Cheers

Posted (edited)

I rewrote this script as a function, currently it will only work on mass files of the same extension I don't have single file functionality programmed in yet.

: : E x a m p l e : :
#include <FileRename.au3>
;             FileRename(iflag, "extension", "source", "destination")
$ireturn = FileRename(0, "txt", "Example\Source\", "Example\Destination\")
MsgBox(0, "Return", $ireturn)


;__________________________________________________________
; F L A G S
; 0 = all files
; 1 = single file
;__________________________________________________________

;__________________________________________________________
; R E T U R N S
; 0 = incorrect $iflag
; 1 = invalid extension
; 2 = source folder/path does not exist
; 3 = destination folder/path does not exist
; 4 = no files found
; 5 = unable to get file info
; Success = No errors
; Unknown Error = Script finished but there was an error
;__________________________________________________________

FileRename_Func.zip

Edited by chaos945

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...