I am not sure if it is valid question. Is it possible to detect type of stdout or stdin of python script? I wanted to check if stdin/ stdout is a folder/ derectory or data or binary types.
Basically I am trying to extract files from archive using python script. However, instead of extracting, the script I use write in to stdout. I just want to manipulate this stdout to find directory then create in the destination then find data/file/bin and extract from archive to destination directory.
Is it possible to do that?
Updtate
Here is what the scripts lists from iso container where /BOOT/GRUB2_EF
is a directory.
C:\Users\Sundar\Documents\multibootusb>iso9660.py i:\home\sundar\openSUSE-13.1-K
DE-Live-x86_64.iso
/
/BOOT
/BOOT/0XA89369.
/BOOT/BOOTPART.CFG
/BOOT/GRUB2_EF
/BOOT/GRUB2_EF/GRUB.CFG
I tryid to create directory using this command:-
C:\Users\Sundar\Documents\multibootusb>iso9660.py i:\home\sundar\openSUSE-13.1-K
DE-Live-x86_64.iso /BOOT/GRUB2_EF/THEMES > dir
However, this is what i got and it is not a directory...
C:\Users\Sundar\Documents\multibootusb>dir
.
.
23/02/2014 11:52 AM 5,000 detect_iso.py
23/02/2014 11:53 AM 3,152 detect_iso.pyc
23/02/2014 06:07 PM 2,048 dir
16/02/2014 07:30 PM <DIR> dist
08/12/2013 06:31 AM 230 install_distro.py
Update2
C:\Users\Sundar\Documents\multibootusb>iso9660.py i:\home\sundar\openSUSE-13.1-K
DE-Live-x86_64.iso /ISOLINUX.CFG > file.cfg
Here is the content of file.cfg
default openSUSE_13.1_KDE_Live
implicit 1
display isolinux.msg
.
.
It looks like this is the tool you are using?
https://github.com/barneygale/iso9660/blob/master/iso9660.py
This tool does one of two things:
That's it. If you want it to extract all files that you are seeing, you will need to invoke it once for every file. I don't know much about cmd.exe scripting, but you might be able to take the output of iso9660.py where it prints every file and pipe it into a for loop that runs iso9660.py again once for every file.
Per a note from the OP, the only way to skip directories in the output is to skip lines that don't have a "." in them.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.