Marked as: Advanced
Hello,
If you run into trouble with JFS volumes chkdisk may at times release files due to problems with the internal structure. June (
http://ecomstation.ru/jrescuer ) may then be the tool for you to use to recover those files, but you can only recover the filenames togheter with the file if you've previously set the .LONGNAME Extend Attribute (EA) as JFS doesn't keep the path nor filename info as e.g. HPFS (partially) does.
The documentation for June/JRescuer mention that you shold set the EA so that June can use the info when it has to recover a file.
I've extended the original script to include the progressbar and information about the folders it process that was lacking. This version doesn't take any parameters as it process all local drives.
Solution included in this script for you to study:
How to calculate the progress even if you only have found out info about the current folder.
Function that call itself several times (recursive calls)
Good:
Can begin to process files almost immediately
Not good:
Time calculation for ( recursive ) functions doesn't work
Possible improvements:
Remove recursive calls and put everything in loops
Add time estimation when the script may be done.
//Jan-Erik
Changes 2008-05-15:
Replaced text with █ (Alt + 219) and ░ (Alt + 176)
or use some other characters if you want to...
to select one or more drives, modify code before the line:
drives = SysDriveMap( , 'LOCAL' )
to something like
if ARG() > 0 then
drives = ARG(1)
else
be sure to specify the parameters for the drives such as
E: F: G:
or one path like
I:\path\to\set\long\ea
when you run it then.
/*
Script: Set .LONGNAME EA for all files in specifiled
directory and subdirectories.
*/
call rxFuncAdd "SysLoadFuncs" , "RexxUtil" , "SysLoadFuncs"
call SysLoadFuncs
call SysCls
call rxBusy 'Searching drives...one moment please.', 0
elapsed = TIME( 'R' )
drives = SysDriveMap( , 'LOCAL' )
do i = 1 to words( drives )
call processPath subword( drives, i, 1 ), ( i - 1 ) / words( drives ), 1 / words( drives )
call rxProgress i / words( drives ), 2
end
exit 0
processPath: procedure expose elapsed counter_
p = arg(1)
progress = arg(2)
chunk = ARG(3)
call rxBusy 'Processing '||p, 0
call SysFileTree p||'\*', 'folder', 'DO'
do j = 1 to folder.0
call processPath folder.j, progress + j / folder.0 * chunk, chunk / folder.0
end
drop folder.
call SysFileTree p||'\*', 'file', 'FO'
do i = 1 to file.0
if TIME( 'E' ) > 1 + elapsed then do
call rxBusy 'Processing '||p, 0
call rxProgress progress + i / file.0 * chunk, 2
elapsed = TIME( 'E' )
end
rc = SysGetEA( file.i, ".LONGNAME", "tmp" )
if rc \= 0 | tmp="" then do
name = FILESPEC( 'N', file.i )
nameinfo = 'FDFF'x || d2c(length(name)) || '00'x || name
call SysPutEA file.i, ".LONGNAME", nameinfo
end
end
drop file.
return
/* part, of_total, display_on_row */
rxProgress: Procedure
if datatype( ARG(1), 'N' ) then
do
progress = trunc( 76 * ARG(1) )
call rxOut left( copies( '█', progress )||copies( '░', 76 - progress ), 76 )||right( trunc( 100 * ARG(1) )||'%', 4 ), ARG(2)
end
Return 0
rxBusy: Procedure expose counter_
SELECT
WHEN counter_ = 1 THEN
call rxOut '/ '||ARG(1), ARG(2)
WHEN counter_ = 2 THEN
call rxOut '- '||ARG(1), ARG(2)
WHEN counter_ = 3 THEN
call rxOut '\ '||ARG(1), ARG(2)
OTHERWISE
counter_ = 0
call rxOut '| '||ARG(1), ARG(2)
END
counter_ = counter_ + 1
Return 0
/* text, display_on_row */
rxOut: Procedure
if datatype( ARG(2), 'W' ) then
parse value SysCurPos( ARG(2), 0 ) with prev_row prev_col
say left( ARG(1), 80 )
if datatype( ARG(2), 'W' ) then
call SysCurPos prev_row, prev_col
Return 0