Hi,
i want to change my (from another one ;)) backup-script to create the backups 
in subdirectory not in current directory.

e.g.
currently 
C:\test.txt is backupped as C:\test.txt.bak
i want backup ist as C:\_bak\Test.txt.bak

here the script:
function OnBeforeSave(filename)
        local sbck = tonumber(props['backup.files'])
        -- no backup specified
        if sbck == nil or sbck == 0 then
                return false
        end
        local nbck = 1
  --output:ReplaceSel("test")
        while (sbck > nbck ) do
                local fn1 = sbck-nbck 
                local fn2 = sbck-nbck+1 
                os.remove (filename.. "." .. fn2 .. ".bak")
                if fn1 == 1 then
                        os.rename (filename .. ".bak", filename .. "." .. fn2 
.. ".bak")
                else
                        os.rename (filename .. "." .. fn1 .. ".bak", filename 
.. "." .. fn2 .. ".bak")
                end
                nbck = nbck + 1
        end
        os.remove (filename.. "." .. ".bak")
        os.rename (filename, filename .. ".bak")
        return false
end

simply adding "_bak\\".. before some filenames don't work. i must split the 
filename...
i've tried with string.gsub but not successful. is there a command to 
manipulate strings with regex? any example?
i read the scitelua.html and documentation of Lua 4.0 
(http://www.lua.org/manual/4.0/manual.html#6.2) but found no way to use regex 
only this "pattern-format" which seems similar...
can anybody help me with this?

regards Frank
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to