Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


RE: need help to exclude a folder

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,33655
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> RE: need help to exclude a folder
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: <<   < prev  1 [2]
Login
Message << Older Topic   Newer Topic >>
 RE: need help to exclude a folder - 4/28/2006 7:12:00 AM   
  ehvbs

 

Posts: 2204
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi kracksmith,

Many thanks to your help, time, and effort in resolving my problem.
[...]
   You are welcome - and don't underestimate your contribution to our script:
   questions go into the answers.

Just curious, can the default directory "c:\temp\delsel" be a network
directory as in \\prod2\temp\delsel??
   Yes, but expect security/permission problems

Would I be able to run multiple default directories by just adding as
in c:\temp\delsel1, and c:\temp\delsel2, and etc..... ?
   In prinziple, yes - but:
   
      The scalar/single variable sSDir has to be replace by an array
     
      Dim aSDirs : aSDirs = Array( "c:\temp\delsel", "\\prod2\temp\delsel" ... )
     
      The specifications of folders/files must use the *correct*
      leading parts:
     
      dicXFP.Add aSDirs( 0 ) + "\dir1\dir11"           , 0
      dicXFP.Add aSDirs( 1 ) + "\some\dir\on\prod2"    , 0
     
      The entry into the recursive traversal has to be put into a loop
     
      Else
         For nIdx = 0 To UBound( aSDirs )
             delSelFiles3 oFS, aSDirs( nIdx ), dicXFP, dicEXT, dicPFP, true
         Next   
      End If
     
      You could argue that the folders/files definitions are specific to each
      start directory - working on the c:\start subtree doesn't need to know
      about folders to ignore under d:\start. Then we had to arrayify (?)
      or dictionarize (?) all these dic??? too.
     
By the way, I will be away for the weekend and until wednesday. So do some
experiments with the code, but don't let your boss talk you into accepting
any deadlines!
 

(in reply to kracksmith)
 
 
Post #: 21
 
 RE: need help to exclude a folder - 5/2/2006 5:23:52 AM   
  kracksmith

 

Posts: 198
Score: 0
Joined: 2/24/2005
From:
Status: offline
After doing some extensive testing I came up with this error on line 75  char 1 "For Each oFile In oThisDir.Files".
The error code is 800A0046 permissioned denied.

This is deleting something from the local drive not network.
I'm not able to pin point which files locally it doesn't have permission. I am logged in as admin and excuted this script as admin.

This error shouldn't even come up right?

Will it hurt just to mask the error since it's only a permission error?


as for creating an array we can just forget it for now. i have too much on my plate to test.


Thanks



(in reply to ehvbs)
 
 
Post #: 22
 
 RE: need help to exclude a folder - 5/2/2006 6:43:07 AM   
  didorno

 

Posts: 361
Score: 0
Joined: 2/12/2005
From:
Status: offline
ehvbs wrote :
quote:

(2)    Yes - if you think its possible that someone else deletes the file after the script found it and before the
           script deletes it or that the file is locked/used or that there may be permission problems. Then do it this way

           On Error Resume Next
          
oFS.DeleteFile( oFile.Path )
           If 0 <> Err.Number Then
               If bVerbose Then WScript.Echo "can't delete " + oFile.Path
           End If
           On Error GoTo 0


One time I did found that a too long file name (including path around 256 chars) prevents deleting of the file with this approach.
Now I use something like the next code.

      

Kracksmith, in the error case you could check the total name length if this is true.

Regards.

< Message edited by didorno -- 5/2/2006 6:45:45 AM >


_____________________________

Regular Expression ? I (L+o{1,}v{1,3}e\s)+[iI]t!$

(in reply to kracksmith)
 
 
Post #: 23
 
 RE: need help to exclude a folder - 5/2/2006 8:36:23 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: online
If it is file manipulation and long paths that is the problem, then you can get around the problem thusly:

1) Check the length of the path. If it is small enough, then move along and do your copy. If not then do this:
2) Find the first \ that occurs before the length limit (InStrRev)
3) Get all of the path from the beginning of the path up to that \ that you just found into a var (call it strTruncatedPath).
4) Map the first open drive letter using strTruncatedPath for where to map it to.
5) Now you can do your copy command using your nwe drive letter and whatever is left of the original path.
6) unmap the drive.

There are some things that will make this not work and it is very hacky, but it should work.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to didorno)
 
 
Post #: 24
 
 RE: need help to exclude a folder - 5/3/2006 7:22:26 AM   
  didorno

 

Posts: 361
Score: 0
Joined: 2/12/2005
From:
Status: offline
ebgreen, this is a new approach for me, thank you !
After a number of problems with too long file names in saved web pages, I made a program that scans the files on an entire drive,
looks to the name length and copies the 'long' files with after the last '\' a fixed number of the original chars (say 30), followed by
'yyyymmddhhmmss' followed by the dot + extension.
In this way the names stay unique and you see enough of the original name.
After successful copiing, the original saved web pages are deleted.
In this way you get rid of those nasty files.

Regards.

_____________________________

Regular Expression ? I (L+o{1,}v{1,3}e\s)+[iI]t!$

(in reply to ebgreen)
 
 
Post #: 25
 
 
Page:  <<   < prev  1 [2]
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> RE: need help to exclude a folder Page: <<   < prev  1 [2]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts