The-dude Posted January 15, 2020 Posted January 15, 2020 Hi All, I'm trying to convert all folders and subfolders names to upper case but I can't get dirmove to rename the subfolders, it only changes the first folder name. Here's my script- #include <File.au3> Local $FilePath = "C:\Test\" $FileList = _FileListToArray($FilePath, '*', 2) If IsArray($FileList) Then For $x = 1 To $FileList[0] Dirmove($FilePath & '\' & $FileList[$x], StringUpper($FilePath & '\' & $FileList[$x]), 9) Next EndIf Any and all help would be greatly appreciate.
Guest Posted January 15, 2020 Posted January 15, 2020 Use _FileListToArrayRec with Param $FLTAR_RECUR (1) -> Search in all subfolders (unlimited recursion) instead.
The-dude Posted January 15, 2020 Author Posted January 15, 2020 @Musashi I don't get any errors using _FileListToArrayRec with but it doesn't do anything either. Maybe it's my code structure, any suggestions? #include <File.au3> Local $FilePath = 'C:\Test\' $FileList = _FileListToArrayRec($FilePath, '*', $FLTAR_RECUR) If IsArray($FileList) Then For $x = 1 To $FileList[0] Dirmove($FilePath & '\' & $FileList[$x], StringUpper($FilePath & '\' & $FileList[$x]), 9) Next EndIf
Guest Posted January 15, 2020 Posted January 15, 2020 (edited) 35 minutes ago, The-dude said: any suggestions? Example, and be careful with the base directory ! Here I have only set the subdirectories in capital letters. #include <File.au3> #include <FileConstants.au3> #include <Array.au3> Local $sFilePath = @ScriptDir & "\Dirtest" Local $aFolderList = _FileListToArrayRec($sFilePath, '*', $FLTA_FOLDERS, $FLTAR_RECUR) _ArrayDisplay($aFolderList) ; *** just for display If IsArray($aFolderList) Then For $x = 1 To $aFolderList[0] ConsoleWrite($x & @CRLF) ; *** just for display ConsoleWrite("< :" & $aFolderList[$x] & @CRLF) ; *** just for display ConsoleWrite("< :" & StringUpper($aFolderList[$x]) & @CRLF) ; *** just for display Dirmove($sFilePath & '\' & $aFolderList[$x], $sFilePath & '\' & StringUpper($aFolderList[$x]), $FC_OVERWRITE) Next EndIf @The-dude EDIT : In this line you have forgotten a parameter: $FileList = _FileListToArrayRec($FilePath, '*', $FLTAR_RECUR) Correct would be : $FileList = _FileListToArrayRec($FilePath, '*', $FLTA_FOLDERS, $FLTAR_RECUR) Edited January 15, 2020 by Musashi
The-dude Posted January 15, 2020 Author Posted January 15, 2020 @Musashi that worked like a charm - thank you so much! The array display doesn't bother me considering I'll only have to close it once for it to do it's thing.
Guest Posted January 15, 2020 Posted January 15, 2020 (edited) 13 minutes ago, The-dude said: @Musashi that worked like a charm - thank you so much! The array display doesn't bother me considering I'll only have to close it once for it to do it's thing. You can remove all lines (also the _ArrayDisplay ) containing : ; *** just for display Edited January 15, 2020 by Musashi
Moderators Melba23 Posted January 16, 2020 Moderators Posted January 16, 2020 Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now