Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: Some Help Pls, with Deleteing files

  1. #1
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default Some Help Pls, with Deleteing files

    Hi

    I have been writing some scripts for burning my sage tv programs to dvd

    It works great, I managed to use dvdspy to tell if a disk is present, etc, and get user feedback for a seemless interface.

    What i need to work out is how to remove files from the temp directory leftover from burning. IE. Like in dos "del *.*"

    Also how can i remove a directory? I have been playing around with remove in lua, but it does not like *.* !!

    Any help you can give will be received with many thanks...

    Dan

  2. #2
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    Dan, have a look at the luacom thread (sticky post). There is a reference to the filesystem object. This will let you do most any file operation you want.

  3. #3
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    Cheers Mike

    I just paid for my copy of girder, I was still on the freeware version

    Dan

  4. #4
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    Thank you!

    Let me know if you need any help with FSO!

  5. #5
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    Hi

    I am still having problems with this, I have tried the os.remove command and various others but, as i am not a programmer am struggling to get it. I tried to create a function that did not work either...

    Do you have an example of how i can do it, I looked at the sticky posts and the lua docs, + all the links, but it don't work

    I am also tring to get the size of a file, the idea is that if it is bigger than 4.7Gb I want to run a program called rejig to make it fit a dvd, it is so I can record tv shows if I want to keep them to DVD.

    I assume, once I understand how to create a function for delete I should be able to easily create one for getting the size of the file?

    So... In advance thanks for any Help

    Cheers

    Dan

  6. #6
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    Ok,

    Using Lua (Variable Manipulation Script.

    LoadLuaCom ()
    fso = luacom.CreateObject ("Scripting.FileSystemObject")
    fsoeleteFile ("\\\\C:\\test.txt") == 1 then
    fso = nil
    collectgarbage ()


    Notes: In Lua, the \ is an escape character and double \\ equal one \. COM Objects use the C conventions for true and false (1,0) where as LUA uses non-nil and nil.


    See: http://msdn.microsoft.com/library/de...filesystem.asp

  7. #7
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    Hi

    Thanks for the quick responce, this is basically what i tried, but i get the error below...

    error: <statement> expected;
    last token read: `==' at line 3 in string "?"

    This is line 3...

    fsoeleteFile ("\\\\C:\\test.txt") == 1 then

    What does it mean?

    Thanks

    Dan

  8. #8
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    opps cut and paste error
    Code:
    LoadLuaCom &#40;&#41; 
    fso = luacom.CreateObject &#40;"Scripting.FileSystemObject"&#41; 
    fso&#58;DeleteFile &#40;"\\\\C&#58;\\test.txt"&#41;
    fso = nil 
    collectgarbage &#40;&#41;

  9. #9
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    Hi Mike
    I don't get it, I now have this error!...

    error: COM exception.\src\library\tLuaCOM.cpp,357):The parameter is incorrect.

    stack traceback:
    1: method `DeleteFile' [C]
    2: main of string "?" at line 3


    Cheers

    Dan

  10. #10
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    Don't WorryI have done it!

    I had to change the code you gave me to this

    LoadLuaCom ()
    fso = luacom.CreateObject ("Scripting.FileSystemObject")
    fsoeleteFile("C:\\*.log", 1)
    fso = nil
    collectgarbage ()

    it did not seem to like the \\\\ before c: , what does \\\\ that do?

    Cheers

    Dan

Posting Permissions

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