Jump to content

Recommended Posts

Posted

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. 

Posted

Use _FileListToArrayRec with Param $FLTAR_RECUR (1) -> Search in all subfolders (unlimited recursion) instead.

Posted

@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

 

Posted (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 by Musashi
Posted (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 by Musashi
  • Moderators
Posted

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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
×
×
  • Create New...