MSFN Forum: issue with batch deleting, any help? - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

issue with batch deleting, any help? Rate Topic: -----

#1 User is offline   MgmTest 

  • Newbie
  • Group: Members
  • Posts: 32
  • Joined: 13-January 12
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 30 September 2012 - 07:36 AM

my folder name is in () It can't delete the file inside of it.
also if the file name is like Zircon-Just (alpha team remix).flp" or having + in it's name can't getting delete.

+ChristophMaitland+Veela-Fall silently.flp

FOR /D %%p IN ("%ProgramFiles(x86)%\Test\(CF3 Support)\*.*") DO rmdir "%%p" /s /q

del "%ProgramFiles%\Test\(CF3 Support)\Preset Sample Image.png"



#2 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,448
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 30 September 2012 - 08:16 AM

View PostMgmTest, on 30 September 2012 - 07:36 AM, said:

my folder name is in () It can't delete the file inside of it.
also if the file name is like Zircon-Just (alpha team remix).flp" or having + in it's name can't getting delete.

+ChristophMaitland+Veela-Fall silently.flp

FOR /D %%p IN ("%ProgramFiles(x86)%\Test\(CF3 Support)\*.*") DO rmdir "%%p" /s /q

del "%ProgramFiles%\Test\(CF3 Support)\Preset Sample Image.png"


Which OS?
Which Filesystem?
It works here on XP/NTFS ( having set ProgramFiles(x86)=C: ) what is the output of
SET  ProgramFiles

?
@ECHO OFF
SET ProgramFiles(x86)=C:
SET Program
ECHO.
DIR /S /B "%ProgramFiles(x86)%\Test\(CF3 Support)\"
ECHO.
FOR /D %%p IN ("%ProgramFiles(x86)%\Test\(CF3 Support)\*.*") DO rmdir "%%p" /s /q

DIR /S /B "%ProgramFiles(x86)%\Test\(CF3 Support)\"


Quote

C:\test>rmdirtest.cmd
ProgramFiles=C:\Programmi
ProgramFiles(x86)=C:

C:\Test\(CF3 Support)\a folder with spaces (and + and - and brackets)
C:\Test\(CF3 Support)\A_file.txt
C:\Test\(CF3 Support)\a folder with spaces (and + and - and brackets)\+ChristophMaitland+Veela-Fall silently.flp
C:\Test\(CF3 Support)\a folder with spaces (and + and - and brackets)\Zircon-Just (alpha team remix).flp

C:\Test\(CF3 Support)\A_file.txt

C:\test>




jaclaz

#3 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,352
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 30 September 2012 - 10:47 AM

I say it a permission issue, if you are using Vista and up. Try to right click the script and select
Run As Admin.

#4 User is offline   MgmTest 

  • Newbie
  • Group: Members
  • Posts: 32
  • Joined: 13-January 12
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 30 September 2012 - 12:27 PM

Thanks But x86 x64 windows 7.

#5 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,448
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 30 September 2012 - 12:33 PM

View PostMgmTest, on 30 September 2012 - 12:27 PM, said:

Thanks But x86 x64 windows 7.

View Postgunsmokingman, on 30 September 2012 - 10:47 AM, said:

I say it a permission issue, if you are using Vista and up. Try to right click the script and select
Run As Admin.

:whistle:

In order to try and help people (actually coming here and asking for help) we often need to ask questions.
You can easily spot them because they have a small "hook" sign "?" at the end.
You were asked THREE of them:
  • Which OS?
  • Which Filesystem?
  • what is the output of "SET ProgramFiles"?


Right now we have a (vague) answer to only the first one, i.e. now we know that you are running Windows 7 (and probably the 64 bit version of it), and such a system WILL have issues with permissions IF the target is on a NTFS filesystem (question #2) AND it is run NOT with Administrator permission.

Them someone may suggest you to try something, like:

View Postgunsmokingman, on 30 September 2012 - 10:47 AM, said:

Try to right click the script and select Run As Admin.

It would be nice if you could actually try the suggestion and report what happens. :yes:


jaclaz

This post has been edited by jaclaz: 30 September 2012 - 12:41 PM


#6 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,352
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 30 September 2012 - 01:32 PM

View Postjaclaz, on 30 September 2012 - 12:33 PM, said:

View PostMgmTest, on 30 September 2012 - 12:27 PM, said:

Thanks But x86 x64 windows 7.

View Postgunsmokingman, on 30 September 2012 - 10:47 AM, said:

I say it a permission issue, if you are using Vista and up. Try to right click the script and select
Run As Admin.

:whistle:

In order to try and help people (actually coming here and asking for help) we often need to ask questions.
You can easily spot them because they have a small "hook" sign "?" at the end.
You were asked THREE of them:
  • Which OS?
  • Which Filesystem?
  • what is the output of "SET ProgramFiles"?


Right now we have a (vague) answer to only the first one, i.e. now we know that you are running Windows 7 (and probably the 64 bit version of it), and such a system WILL have issues with permissions IF the target is on a NTFS filesystem (question #2) AND it is run NOT with Administrator permission.

Them someone may suggest you to try something, like:

View Postgunsmokingman, on 30 September 2012 - 10:47 AM, said:

Try to right click the script and select Run As Admin.

It would be nice if you could actually try the suggestion and report what happens. :yes:


jaclaz

Now any body with half a brain wouldm of seen this, "%ProgramFiles% and that on Vista and up and if the UAC has not been disable
it requires Admin rights to delete any folder or contents.

#7 User is offline   MgmTest 

  • Newbie
  • Group: Members
  • Posts: 32
  • Joined: 13-January 12
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 02 October 2012 - 05:08 AM

Hi I am using windows 7 x86 and also x64 with NTFS file system and also uac is disabled, but it doesn't work for me. also I want it to be compatible with vista and windows 8. thanks guys for your helps.

#8 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,448
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 02 October 2012 - 05:23 AM

View PostMgmTest, on 02 October 2012 - 05:08 AM, said:

Hi I am using windows 7 x86 and also x64 with NTFS file system and also uac is disabled, but it doesn't work for me.

Too bad. :(


View PostMgmTest, on 02 October 2012 - 05:08 AM, said:

also I want it to be compatible with vista and windows 8.

Good luck :).

View PostMgmTest, on 02 October 2012 - 05:08 AM, said:

thanks guys for your helps.

Why? :w00t: You evidently do not want to get help. :no:

jaclaz

#9 User is offline   MgmTest 

  • Newbie
  • Group: Members
  • Posts: 32
  • Joined: 13-January 12
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 02 October 2012 - 05:49 AM

haha you are funny but being funny is not answer to may question.
as I mentioned before this is my problem: my folder name is in () It can't delete the file inside of it.
also if the file name is like Zircon-Just (alpha team remix).flp" or having + in it's name can't getting delete.

the script you gave me doesn't work fine on all version of windows I look for something which is working fine and smooth on all version of windows.

#10 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,448
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 02 October 2012 - 06:23 AM

View PostMgmTest, on 02 October 2012 - 05:49 AM, said:

haha you are funny but being funny is not answer to may question.

EXACTLY like your posts are NOT the anwers to the questions I asked, but are merely a re-post.

So we are perfectly even :thumbup , you don't answer to the questions I ask, and I do not provide an answer to your question/problem, the difference being that everything works for me Posted Image, while it doesn't for you :no: .

jaclaz

#11 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,352
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 02 October 2012 - 10:59 AM

1:\ Are you trying to remove %ProgramFiles(x86)%\Test\(CF3 Support)\ and all it sub folders and files?
2:\ Or are you trying to remove from %ProgramFiles(x86)%\Test\(CF3 Support)\ all the files and leave the folder empty?

Here is a VBS script that I tested to remove a folder in the Programfiles

Test Path = C:\Program Files (x86)\Test-(Delete) Me
Remove Folder

Quote

How I ran it on Win 7 x64 UAC enable
1:\ Open Cmd Promt with admin right
2:\ CD to script location EG CD C:\Users\Gunsmokingman\Desktop
3:\ Type this in Cmd Promt Window Wscript Test_Delete_ProgramFiles.vbs

VBS Script
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Loc :Loc = "C:\Program Files (x86)\Test-(Delete) Me"
 If Fso.FolderExists(Loc) Then Fso.DeleteFolder(Loc),True  




List Files In ProgramFiles Folder

Quote

How I ran it on Win 7 x64 UAC enable
1:\ Open Cmd Promt with admin right
2:\ CD to script location EG CD C:\Users\Gunsmokingman\Desktop
3:\ Type this in Cmd Promt Window Cscript Test_Delete_ProgramFiles.vbs
this will show all the files in the parent directory in the Cmd Promt window

VBS Script
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Loc :Loc = "C:\Program Files (x86)\Test-(Delete) Me"
' If Fso.FolderExists(Loc) Then Fso.DeleteFolder(Loc),True  

Dim Obj 
  For Each Obj In Fso.GetFolder(Loc).Files
    WScript.Echo Obj
   'Fso.DeleteFile(Obj),True   
  Next 




Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy