Monday, July 19, 2010

Picasa Hidden Folder Finder

I know this might seem sketchy, but hey, it's my diary. I don't use Picasa, but I did for a while and I learned that Picasa keeps folder information in separate INI files for each folder. Then I read a post on 'Wait till I come!' (yeah, I don't get the name....) that Picasa uses a "hidden" tag in the INI file for folders that the user does not want to be included in Picasa. He mentioned Total Commander, but to me, a batch file makes a tad more sense. So I made one.

I did this mostly to learn more about Batch files, but also because I wanted to feel like a 1337 hacker. There's basically one line of code that you can run from the root folder (like C:\), but I just wrote it to be a bit more user friendly by adding a menu that will take you straight to that folder.

findstr /S /I /M /B "hidden" .picasa.ini
The "lite version" is basically just the command; it's fairly easy to remember: 'find string simb hidden dot picasa dot INI' is how I would. /S searches in subdirectories of the current folder; /M prints the filename instead of the line, so it's essential; /I tells it the search is not case sensitive; and /B returns files only if "hidden" is at the beginning of a line.

@echo off
echo %%%%%%%%%%%%%%Picasa Hidden Folder Finder%%%%%%%%%%%%%%
REM Extremely short simple version is 'findstr /S /I /M /B "hidden" .picasa.ini' from the root folder.
set drive=%cd:~0,3%
echo Scanning %drive%.....
set i=1
cd %drive%
for /F "delims=" %%a in ('findstr /S /I /M /B "hidden" .picasa.ini') do (
set __INIFILE.!i!=%%a
echo !i!.  %drive%%%a
set /a i+=1
IF %i%==1 (goto NoFiles)
echo S. SAVE
echo Q. QUIT

set /p ChooseFile=Choose a file:
IF %ChooseFile%==Q (exit)
IF %ChooseFile%==q (exit)
IF %ChooseFile%==s (goto Save)
if %ChooseFile%==S (goto Save)
FOR /F "tokens=2* delims=.=" %%A IN ('SET __INIFILE.') DO (
 IF %%A==%ChooseFile% (
 set var=%drive%%%B
 set var=!var:Picasa.ini=!
 echo Opening !var!
 %SystemRoot%\explorer.exe "!var!"
echo That is not a valid selection.

FOR /F "tokens=2* delims=.=" %%A IN ('SET __INIFILE.') DO (
echo %drive%%%B >> %~dp0PHFF.txt
echo Saved to %~dp0PHFF.txt

echo No hidden Picasa albums were found on %drive%

So yeah. I'm not really well-versed in Batch files. The loops confounded me for ages, and I still don't fully understand them.

Anyway, do with it what you may.

No comments:

Post a Comment