DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Open the corresponding folder of the found files  (Read 9,466 times)

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Open the corresponding folder of the found files
« on: July 31, 2012, 07:25 PM »
Open the corresponding folder of the found files

I would like a soft for :

Open the corresponding folder of the found files.

suppose I would like to find the file "abc.txt" in one of my hard disks.

When the file is found the corresponding folder is opened. That's the idea.

I suppose if many files are encountered may be problem with the memory or the operative system. So better is possible open in series.

Best Regards
:-*

AbteriX

  • Member #520
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 1,150
Re: Open the corresponding folder of the found files
« Reply #1 on: July 31, 2012, 09:23 PM »
"found files" ? Where? In WinExplorer?
In WinExplorer there is an option to open the parent folder (try context menu) already.
Greetings, Stefan.

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Open the corresponding folder of the found files
« Reply #2 on: July 31, 2012, 10:53 PM »
Open folder automatically when the file is found
I have to do nothing
:P

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
Re: Open the corresponding folder of the found files
« Reply #3 on: August 01, 2012, 12:10 AM »
How are you finding the file?

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • Coding Snacks
Re: Open the corresponding folder of the found files
« Reply #4 on: August 01, 2012, 01:23 AM »
OpenFolderThatHas filename

Opens every folder on the drive the script is run from, that contains a file filename. May use wildcards like *.cmd or *.txt. It only accepts one argument.  filename

It opens the folder and waits until the window is closed to do the next Loop.

Edit: prompts for filename if none on command line. Enter just a filename, no drive or path (e.g. readme.txt)

Code
if 0 < 1
{
  InputBox,filename,,Enter File Name with no path
  if (ErrorLevel)
    ExitApp
}
else
  filename = %1%
tmp := A_ScriptDir
StringLeft,drive,tmp,3
FilePat := drive filename
Loop, %FilePat%,,1
{
  tmp := _FileDir(A_LoopFileLongPath)
  ;MsgBox, 8256, Test, %A_LoopFileLongPath%`n%tmp%
  Run,%tmp%
  WinWaitActive,%tmp%,,5
  if (ErrorLevel)
    continue
  while WinExist(tmp)
  {
    Sleep,250
  }
}

_FileDir(path)
{
  SplitPath,path,,fdir
  return fdir
}

edit: I removed the "#notrayicon" so it can be killed via tray icon to break the loop. Also note that it waits until a window with the title that matches the folder name no longer exists. If you happen to have the same folder already open, it will hang. So close all explorer windows before running, or fix the script. :)
« Last Edit: August 02, 2012, 02:48 AM by MilesAhead »

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Open the corresponding folder of the found files
« Reply #5 on: August 02, 2012, 12:45 AM »
How are you finding the file?

I suppose with the same program used to open the folder.

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Open the corresponding folder of the found files
« Reply #6 on: August 02, 2012, 12:46 AM »
How are you finding the file?

I suppose with the same program used to open the folder.


Trying

I will comment
:-*

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Open the corresponding folder of the found files
« Reply #7 on: August 02, 2012, 12:48 AM »
OpenFolderThatHas filename

Opens every folder on the drive the script is run from, that contains a file filename. May use wildcards like *.cmd or *.txt. It only accepts one argument.  filename

It opens the folder and waits until the window is closed to do the next Loop.

Code
if 0 < 1
{
  MsgBox, 8256, Open Folder That Has, Usage: ofth filename
  ExitApp
}
filename = %1%
tmp := A_ScriptDir
StringLeft,drive,tmp,3
FilePat := drive filename
Loop, %FilePat%,,1
{
  tmp := _FileDir(A_LoopFileLongPath)
  ;MsgBox, 8256, Test, %A_LoopFileLongPath%`n%tmp%
  Run,%tmp%
  WinWaitActive,%tmp%,,5
  if (ErrorLevel)
    continue
  while WinExist(tmp)
  {
    Sleep,250
  }
}

_FileDir(path)
{
  SplitPath,path,,fdir
  return fdir
}

edit: I removed the "#notrayicon" so it can be killed via tray icon to break the loop. Also note that it waits until a window with the title that matches the folder name no longer exists. If you happen to have the same folder already open, it will hang. So close all explorer windows before running, or fix the script. :)

Owwww. I think I made a mistake in the post above.
Really I wanted to quote this post

Trying

Best Regards
:-[

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Open the corresponding folder of the found files
« Reply #8 on: August 02, 2012, 12:53 AM »
Don't ask me the name of the file ?
I double click but only obtain an error window.

Usage: ofth filename

Accept

What can I do now ?

Going to study the commands to see what I have to understand in the script.

:-[

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • Coding Snacks
Re: Open the corresponding folder of the found files
« Reply #9 on: August 02, 2012, 01:23 AM »
Don't ask me the name of the file ?
I double click but only obtain an error window.

Usage: ofth filename

Accept

What can I do now ?

Going to study the commands to see what I have to understand in the script.

:-[

See code I posted above. I shows an inputbox if no file on command line.
« Last Edit: August 02, 2012, 01:50 AM by MilesAhead »

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Open the corresponding folder of the found files
« Reply #10 on: August 04, 2012, 11:32 AM »
Hi everybody,
i am really shoked. because i lost my files lasy two day's. and now i am trying to my best for find these  files . i saved my files in my desktop folder. but it is now shown that corresponding folder. that's why i do not find my files. now what can i do for finding my files.

Hello batlon13.
I suppose you need the help of someone like me  :-[
Trying
Sometimes a simple click can move a folder to another place.
If you know the name of some of the files you lost I think you can recover. Even possibly the files are in the trash folder.
You can try to find them with Windows Explorer, or Locate32 (a powerful search program)
Happen me in the past that visiting any folder I found the lost folder some time ago....
:-*

4wd

  • Pedantic Old Bastard
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,652
    • Coding Snacks
Re: Open the corresponding folder of the found files
« Reply #11 on: August 05, 2012, 12:37 AM »
Or immediately after you've done the action, you can right-click on the Desktop and select Undo .... for the last action.
"I will not follow where the path may lead, but I will go where there is no path, and I will leave a trail." - Muriel Strode, 1903

Original address: https://www.donationcoder.com/forum/index.php?topic=31801.0