Szervusztok!
Általában véve Windows felhasználók FTP-én keresztül képeket töltenek fel egy könyvtárba ahonnan egy Java program bedolgozza őket a galéria alkalmazásba.
A Windows cp852-es kódolású file neveket használ míg a Solaris UTF-8 -at, ezért az ékezetes karakterek torzulnak. Ez még nem volna probléma mert a file neve nem hordoz információt és nincs is rá szükség, azonban a Java sajnos csak név szerint tud hozzáférni a fileokhoz amit nem tud megtenni mert a nem nyomtatható karakterek által behejettesített kérdő jelek adatvesztést okoztak a file nevekben.
Szükségem volna egy olyan rendszer programra amit a Java a file-ok bedolgozása előtt meghívna és ennek segítségével mondjuk inode szintű file hozzáféréssel képes volna azokat átnevezni valamilyen egyszerűsített névre.
Sajnos az mv nem jó mert ott megint név szerint kell hivatkozni. Van valami olyasmi ami mondjuk egy könyvtárban lévő file-ok inode listáját adja vissza és ezen inode-ok szerint lekérhető a file neve illettve inode hivatkozás által át is nevezhető?
Válaszokat nagyon köszönöm!
--
sirkalmi
- 5618 megtekintés
Hozzászólások
Hali!
ls -i
de szerintem ha csinálsz egy kis bash scriptet az átnevezgetéshez, az mv-t nem fogja érdekelni, hogy a source név "furcsa", csak escape-ld ki.
- A hozzászóláshoz be kell jelentkezni
> Sajnos az mv nem jó mert
- A hozzászóláshoz be kell jelentkezni
Működik Solaris alatt is, kirpóbáltam!
Rename Linux files, base on file inode number.
To rename file or directory in Linux using the inode number, we need to know their inode number. Use the ' ls -i ' to find out the inode number for the files or directory.
[root@fedora ~]# ls -i
648389 anaconda-ks.cfg 97315 example-directory 1847716 install.log.syslog
97582 Desktop 1847715 install-fedora.log 648395 X.txt
Now let use the example-directory with inode number 97315 as an experiment for the example.
Now, execute the find command to find the example-directory inode number than rename that directory to new-directory-name.
[root@fedora ~]# find . -inum 97315 -exec mv {} new-directory-name \;
find: ./example-directory: No such file or directory
To verify the change on the directory name, use the ls command with the ' -i ' option to list file and folder including their inode number.
[root@fedora ~]# ls -i
648389 anaconda-ks.cfg 1847715 install-fedora.log 97315 new-directory-name
97582 Desktop 1847716 install.log.syslog 648395 X.txt
Command explanations:
• The 'ls -i' command is usually to get the inode number for file and directory in Linux or Unix system:
ls -i
• This line of command use 'find' command to find the inode number given than execute the 'mv' command to rename the file or directory:
find . -inum 97315 -exec mv {} new-directory-name \;
• To verify the changes to the filename 'ls -i' is use again:
ls -i
--
sirkalmi
- A hozzászóláshoz be kell jelentkezni