Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

So we copied some photos in a directory across to a NTFS partition last night, and they were viewable from ubuntu.

Today the directory is not accessible from Windows, and when we booted back into linux, the directory appears as a file and Nautilus thinks its a gzip archive.

ls -la gives the following:

-rw------- 1 kim kim 16769 Jun 17 22:47 DirectoryName

My assumption is that the "directory" and its pointers to the other files are still there, it just has the wrong attributes.

I tried

sudo chmod a+rwx DirectoryName

But this didn't have any affect.

Any ideas how I can convince my directory that its a directory again??

Or otherwise recover the files that are now orphaned on the drive?

update and solution

So I went home last night, tried to open the directory in Windows but it is still represented as a file in explorer. So I booted back into ubuntu to run

file MyDirectory

And the "file" is now gone. Not even appearing via ls anymore.

So we took a different tack, and recovered the files from the SD card using this excellent tool.

Thanks all for your help anyway

share|improve this question
    
Does Windows use some sort of SSD cache device on that system? –  Stéphane Chazelas Jun 19 '13 at 6:58
    
No, no SSD on this device... just a single HDD –  mwjackson Jun 19 '13 at 7:39
    
Let me venture a wild guess: what happens when you do sudo mount -o loop /path/to/problem_file /mnt; ls /mnt? –  Joseph R. Jun 19 '13 at 7:59
3  
For determining what this "thing" actually is it is often helpful to run the file command on it. –  scai Jun 19 '13 at 8:34
    
Was Windows in a hibernation state when you copied the files from Linux to the NTFS partition? –  Christopher Jun 14 at 0:40
add comment

3 Answers 3

Nautilus will normally just copy, unless you tell it to compress, which is probably what you have done accidentally.

The file is a file and not a directory, Nautilus can just display the contents of the file as if it were a directory. So open the file, and drag the contents to a real directory, e.g. one that you made under Windows before booting in Ubuntu. The chmod command has no influence at all on the contents of the file as you already noticed, (older versions of) Windows cannot read such files compressed archives, and have a hard time when the proper extension is missing.

I would not remove the gzip archive file until you have verified you have viewable copies of the images somewhere.

share|improve this answer
add comment

your ls -la output specifies that its a file not a directory

    -drwx where d stands for directory

if its gzip archive then you can gunzip it

    gunzip <filename>
share|improve this answer
    
Yes I know. Unfortunately, it WAS a directory node at some point, and it seems to have lost the +d somehow. –  mwjackson Jun 19 '13 at 7:37
    
As in, 2 days ago it contained files, and after booting into Windows (who can't access the directory, probably due to permissions), it now appears as a file. –  mwjackson Jun 19 '13 at 7:39
add comment

So I went home last night, tried to open the directory in Windows but it is still represented as a file in explorer. So I booted back into ubuntu to run

file MyDirectory

And the "file" is now gone. Not even appearing via ls anymore.

So we took a different tack, and recovered the files from the SD card using this excellent tool.

Thanks all for your help anyway

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.