[OT] Deleting files

  • Thread starter Thread starter El Bandolero
  • Start date Start date
E

El Bandolero

Is it any way of deleting files when you are IN the program that generates
it?
Foe instance I have a lot of old xls files some of them now are useless,
and I want to view AND delete them in a simple and fast way

Any advice?
 
Is it any way of deleting files when you are IN the program that generates
it?

That depends on the program. When the program keeps the data file in
an "always locked" state while processing it, you'll encounter some
difficulties. An output of the full path+name of the datafile inside
the titlebar could help to do it using external scripting and system
tools.
Foe instance I have a lot of old xls files some of them now are useless,
and I want to view AND delete them in a simple and fast way

The example you describe is especially easy, because the program has
powerful built-in macro capabilities. I'll give you an explanation on
basis of your example, although it covers a non-free product. The
same concept would apply to freeware with built in scripting. And even
the external scripting I mentioned above would follow similar concepts.

Create a macro inside your template file (personal.xls or such) and
add code to:
1. retrieve path and name of your document
2. close and delete that document

It could look those:

Sub DeleteCurrent()
Dim sFN As String
sFN = Application.ActiveWorkbook.FullName
Application.ActiveWorkbook.Close
Kill sFN
End Sub

Provide a means for quick action by assigning a hotkey to the macro
or by adding it to the toolbar. You may add code to load the next
file if that seems appropriate.

The general approach I mentioned above would be far more difficult.
I'm not in the mood to provide a solution on that, at the moment. ;-)

BeAr
 
Is it any way of deleting files when you are IN the program
that generates it?
Foe instance I have a lot of old xls files some of them now
are useless, and I want to view AND delete them in a simple
and fast way

Any advice?

In Excel (or most/all program which use the std. windoze Open
dialog):
- close the .XLS, if it's open
- Ctrl+O (file|open)
- highlight the xls you wish to delete
- press Del or Ctrl+Del
- rinse, repeat ...

J
 
The general approach I mentioned above would be far more difficult.
I'm not in the mood to provide a solution on that, at the moment. ;-)

Okay. Now I am. - At least for a sample which could be extended to a
broader functionality if needed. The following AutoHotkey script should
close and delete the current file of a topmost Notepad++ window. Thanks
to the functionality of Notepad++ the user gets the choice to keep the
deleted file in buffer for later saving when the file has been altered
since the last save. More security could easily be added by modifying
the script. Here is the code:

;Delete Current
WinGetTitle, sTitle, A
StringReplace, sFileName, sTitle, Notepad++ -%A_SPACE%
Send ^w
FileDelete, %sFileName%

HTH.
BeAr
 
El Bandolero said:
Is it any way of deleting files when you are IN the program that generates
it?
Foe instance I have a lot of old xls files some of them now are useless,
and I want to view AND delete them in a simple and fast way

Any advice?

Use XYplorer (a file manager with preview skills) as XLS-viewer: simply (1)
select the file in the file list, (2) look at the contents displayed on the
preview tab, and (3) press DEL if you feel like it.

-> http://www.xyplorer.com

Don
 
Back
Top