Jump to content
Sign in to follow this  
ffdshow

Renaming files with spaces in name

Recommended Posts

ffdshow

Hi

I have thousands of files in a folder which has spaces in names (e.g. help file 2.txt)

Is possible to rename those files like this: helpfile2.txt

Share this post


Link to post
Share on other sites
Xenobiologist

Hi

I have thousands of files in a folder which has spaces in names (e.g. help file 2.txt)

Is possible to rename those files like this: helpfile2.txt

HI,

_FileReadToArray and then FileMove with StringStripWS should help you

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
weaponx

HI,

_FileReadToArray and then FileMove with StringStripWS should help you

Mega

Careful here. You want _FileListToArray, i'm sure this was an honest mistake.

Share this post


Link to post
Share on other sites
PsaltyDS

Hi

I have thousands of files in a folder which has spaces in names (e.g. help file 2.txt)

Is possible to rename those files like this: helpfile2.txt

Another possibility is to just work with the 8.3 short names using FileGetShortName().

Even better, upgrade your skilz and your scripts to be OK with names that names that have spaces in them.

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
weaponx

OK

What is wrong in this script?

#Include <File.au3>
#Include <Array.au3>

$path = @ScriptDir
$dest = "C:\folder"
$FileList = _FileListToArray($path, "*.txt")

For $i=1 To UBound($FileList)-1
    $name = StringStripWS($path & $FileList[$i], 8)
    FileMove($path & $FileList[$i], $dest & $FileList[$i] & $name,1)
NextoÝ÷ Ûú®¢×µZ§ºÈ§X¥x¸¬µ:®¶²¶§ºfޮߢéÝ~)^²+)§v)ÞéÝ)¢«b  Þy×è­Fèºwvb§yçZm§$²V¬·­Á秶©jØZÛayø¥zv¦{v(¹Ú'ßÛpj{m¢)Üç^¶¨®("©_W§jg¢Ø^uë-v­éjØ_¢±bã(½æ®¶­sb4æ6ÇVFRfÇC´fÆRæS2fwC°¢4æ6ÇVFRfÇC´'&æS2fwC° ¢b33c·FÒ67&DF ¢b33c¶FW7BÒgV÷C´3¢b3#¶föÆFW"gV÷C°¢b33c´fÆTÆ7BÒôfÆTÆ7EFô'&b33c·FÂgV÷C²¢çGBgV÷C² ¥ô'&F7Æb33c´fÆTÆ7B ¤f÷"b33c¶ÒFòb33c´fÆTÆ7E³Ð¢b33c¶æÖRÒ7G&æu7G&u2b33c·FfײgV÷C²b3#²gV÷C²fײb33c´fÆTÆ7E²b33c¶Ò¢fÆTÖ÷fRb33c·FfײgV÷C²b3#²gV÷C²fײb33c´fÆTÆ7E²b33c¶ÒÂb33c¶FW7BfײgV÷C²b3#²gV÷C²fײb33c¶æÖRäæW@

Share this post


Link to post
Share on other sites
picaxe

Try this (untested)

#Include <File.au3>
#Include <Array.au3>

$path = "c:\util"
$dest = "C:\folder"
$FileList = _FileListToArray($path, "*.txt")

For $i=1 To UBound($FileList)-1
    $name = StringStripWS($FileList[$i], 8)
    FileMove($path & "\" & $FileList[$i], $dest & "\" & $name,1)
Next

too late

Edited by picaxe

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×