#!/bin/bash
# UnCompressedDir.sh
shopt -s globstar
for file in /home/Programs/orthanc/OrthancStorage/* OrthancStorage/**/*
do
/home/Programs/orthanc/Resources/Samples/Tools/RecoverCompressedFile "$file" /home/UncompressedDICOM/"$file" ;
done
This returns the Errors below. Is there a way to decompress multiple files in a directory sucessfully to their orignal DICOM state? Also I am migrating to a new PACS DICOM so I can't use the Replicate option. I tried the Direct Acces Method as well however that process is ingorning several of the images in OrthancStorage.
Reading the file into memory...
terminate called after throwing an instance of 'std::length_error'
what(): basic_string::resize
./UncompressDir.sh: line 4: 23962 Aborted (core dumped) /home/Programs/orthanc/Resources/Samples/Tools/RecoverCompressedFile "$file" /home/Programs/orthanc/OrthancStorage/"$file"
Reading the file into memory...
Decompressing the content of the file...
Error: Zlib: Corrupted compressed buffer
Reading the file into memory...
Decompressing the content of the file...
Error: Zlib: Corrupted compressed buffer
Reading the file into memory...
Decompressing the content of the file...
Error: Zlib: Corrupted or incomplete compressed buffer
Reading the file into memory...
Decompressing the content of the file...
Writing the uncompressed data...
Error: Cannot write to file
Ok no longer getting the buffering Errors however the script is not writing to the new location after decompression. I have given full write permissions to the directory. Any ideas? see script below.
#!/bin/bash
# Intialize Array, Find file names then put them into the Array
names=( $(find /home/Programs/testdev/OrthStorage -type f ) )
# Initialize counter
counter=0
# Print the count and filenames from the Array, Run the (RecoverCompressedFile) program, Pause for 1/20 of second, Loop it over
for dicom in "${names[@]}";
do let counter++; echo "Executing $dicom on file number $counter"; /home/Programs/orthanc/Resources/Samples/Tools/RecoverCompressedFile "$dicom" /home/Programs/testdev/NewStorage/"$dicom" ; sleep .2;
done
Since my last post I finally determined what was happening with the buffering issue but didn't post the resolution. Of course as you mentioned it was bash related below is a script that automates the process. I'm sure it can be improved but it works. Thanks.
###############################################################################
#!/bin/bash
shopt -s globstar
# Intialize Array, Find file names from specific Dir then put them into the Array
names=( $(find /orthdata/volume1/OrthancVol1 -type f) )
# Initialize counter
counter=0
# Print the count and filename, Run the recovery (CPlus) program, Pause for 1/20 of second, Loop it over
for dicom in "${names[@]}"
do
# Remove paths from the Array
dicomimgs="${dicom##*/}"
# Use base filenames for new Array
dicomimgsnull="${dicomimgs%}"
# Display New filename
echo "New file name is ${dicomimgsnull}"
let counter++
echo "Executing $dicom on file number $counter"
/home/Programs/orthanc/Resources/Samples/Tools/RecoverCompressedFile "$dicom" /home/UncompressedDICOM/$dicomimgsnull ; sleep .2;
done
###############################################################################
Since my last post I finally determined what was happening with the buffering issue but didn't post the resolution. Of course as you mentioned it was bash related below is a script that automates the process. I'm sure it can be improved but it works. Thanks.