LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 09-06-2011, 12:32 PM   #1
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Hidden Cygwin .cyg0000* files


I'm using Cygwin 1.7.x.

Every time the rm command is used Cygwin creates .cyg000 files. I have found only one person addressing the issue. Apparently there is some kind of behavior in Cygwin that acts like a pseudo trash bin. The problem is these files don't disappear when the Cygwin session is terminated.

How to stop these files from being created or delete them as quickly as possible. I am trying to deploy Cygwin in an enterprise network and I can't have these pseudo trash files all over the place. I don't want any kind of trash bin behavior.

Deleting them from within Cygwin is impossible because the rm command is what creates the files. Something in Cygwin intercepts the rm command and is moving files rather than actually deleting.

The following command in a batch script does not seem to work:

For /f "tokens=*" %%i in ('dir "S:\.cyg000*" /A:H /B') Do (rmdir /s /q "S:\%%i")

I won't pretend to be an expert in batch file programming and any help is appreciated.

I need to keep this as simple as possible --- no third party tricks.

The ideal solution is something in Cygwin that can be configured to stop this behavior.

Any ideas?

Thanks much!
 
Old 09-06-2011, 01:15 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
In fact, it might be a *Microsoft* version of "rm.exe" that's exhibiting this behavior:

http://cygwin.com/ml/cygwin/2001-08/msg00772.html

In any case, one solution is to modify your environment to alias "rm" to "rm /x".

'Hope that helps .. PGM
 
Old 09-09-2011, 07:19 PM   #3
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Thanks. That might be the case for some people, but I am using the native (linux) rm command in the cygwin environment, not the Microsoft rm command. The whereis command shows only /bin/rm and /usr/bin/rm. No rm commands in the path from Windows directories.

Possibly this behavior is by design: http://cygwin.com/ml/cygwin/2010-07/msg00067.html

A clunky workaround: in my batch file that runs Cygwin I execute the following command after Cygwin terminates:

For /f "tokens=*" %%i in ('dir "S:\.cyg000*" /a:h /b') Do (erase /a:h /q "S:\%%i")

I am hoping others might still be able to shed light on a better solution.

Last edited by Woodsman; 09-09-2011 at 07:22 PM.
 
Old 09-10-2011, 04:18 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Moved: This thread is more suitable in <GENERAL> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 09-12-2011, 06:43 PM   #5
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Looks like both of the following are needed in the batch script file:

For /f "tokens=*" %%i in ('dir "S:\.cyg000*" /a:h /b') Do (erase /a:h /q "S:\%%i")
For /f "tokens=*" %%i in ('dir "S:\.cyg000*" /a:h /b') Do (rmdir /s /q "S:\%%i")

Last edited by Woodsman; 09-12-2011 at 06:44 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I make find exclude hidden files (.files) Rotwang Linux - General 2 08-08-2011 03:58 AM
[SOLVED] Delete regular files (not hidden files) with find + rm in one line older than 15 Virtuose Linux - Newbie 1 01-08-2011 05:24 PM
[SOLVED] recursively cp all directories, files and hidden files WildDrake! Linux - Newbie 9 05-18-2010 04:39 PM
bash: mv hidden and not hidden files lupe Linux - General 4 06-22-2009 01:27 PM
home directory files gone, hidden files remain Grasshopper Linux - Security 12 04-10-2005 08:23 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 04:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration