User Tag List

Results 1 to 7 of 7

Thread: Scan a directory and rename all files (e.g. *,jpg)

  1. #1
    Clicker Fusion 2.5Firefly 3D Module
    Fusion 2.5 (Steam)

    Join Date
    Sep 2007
    Location
    Austria
    Posts
    289
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Scan a directory and rename all files (e.g. *,jpg)

    How can I scan a directory for jpg files and rename them?

    e.g. *.jpg to *.dat

    The code should automatically find all files so I do not have to add them manually (rename 1.jpg -> 1.dat, rename 2.jpg -> 2.dat).

    Please help!

    The files should also be encrypted with the Blowfish object, e.g. encrypt all found .dat files in one go.

  2. #2
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleFirefly 3D Module
    Jaffob's Avatar
    Join Date
    May 2008
    Location
    USA
    Posts
    1,833
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Scan a directory and rename all files (e.g. *,jpg)

    To do this, first add the List Object and File Object to your frame. In the List's properties, uncheck the "1-based index" checkbox.

    I'll pretend the directory containing your files is C:\Folder. In the Event Editor, use the List Object to load a filelist of "C:\Folder\*.jpg" (the action is under the List Object's "Files" submenu). This will add the names of all the JPG files in that directory into your list box.

    From there, start a fastloop, looping the number of lines there are in the List. We'll call this loop "ProcessFile". On each loop, use the File Object's "Rename File" action. The name of the file to rename will be "C:\Folder\"+List Line Text$( "List Object", LoopIndex("ProcessFile")). Rename it to FileName$( "File Object", List Line Text$( "List", LoopIndex("ProcessFile")))+".dat".

    If you want to encrypt the files, use Blowfish on each loop to do so. Feed it that 1st expression as the path to the file.

  3. #3
    Clicker Fusion 2.5Firefly 3D Module
    Fusion 2.5 (Steam)

    Join Date
    Sep 2007
    Location
    Austria
    Posts
    289
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Scan a directory and rename all files (e.g. *,jpg)

    Thank you! "From there, start a fastloop..." -> "on loop" -> "Processfile" -> do what? I don't know how many lines are in the list so all that are found should be automatically be added.

    Ok, my first event is

    Start of frame -> Load list file Apppath$+"dat\*.jpg"

    What next? I never used loops so this is tricky for me.

    Another problem: what is the best way to open a file selector window that you can browse and look at found jpgs? It should all be in the application.

  4. #4
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: Scan a directory and rename all files (e.g. *,jpg)

    The list object can give you the number of times to run the loop.

    The File object has a File Selector.
    Working as fast as I can on Fusion 3

  5. #5
    Clicker Fusion 2.5Firefly 3D Module
    Fusion 2.5 (Steam)

    Join Date
    Sep 2007
    Location
    Austria
    Posts
    289
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Scan a directory and rename all files (e.g. *,jpg)

    I'm too stupid to use it.

  6. #6
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: Scan a directory and rename all files (e.g. *,jpg)

    Quote Originally Posted by Leander
    I'm too stupid to use it.
    Which "it" are you referring to?
    Working as fast as I can on Fusion 3

  7. #7
    Clicker Fusion 2.5Firefly 3D Module
    Fusion 2.5 (Steam)

    Join Date
    Sep 2007
    Location
    Austria
    Posts
    289
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Scan a directory and rename all files (e.g. *,jpg)

    Haven't used the list object and the loop function yet so both are completely new to me.

    Could you post the exact events please?

Similar Threads

  1. Scan a folder for all music files and add them to a list
    By 2xD in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 21st December 2012, 10:05 PM
  2. Is it possible to rename and delete an ini? Or to rename a Group within an ini?
    By fwtep in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 22nd August 2012, 02:18 AM
  3. Copy files in a directory into another
    By K1kk0z90 in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 11th January 2012, 10:54 AM
  4. Copying files 2 another directory
    By SuperKirby64 in forum The Games Factory 2 - Technical Support
    Replies: 10
    Last Post: 4th January 2009, 06:16 PM
  5. How to search for files in a directory?
    By Iharmi in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 25th September 2008, 09:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •