Programming :: Get The Contents Of A Directory In C++?

Dec 27, 2010

How to get the contents of a directory in C++?I know about opendir(), but I wonder if there is a C++ way (that uses classes and exceptions).

View 1 Replies


ADVERTISEMENT

Programming :: How To List Contents Of Directory And Exclude Any Subdirectories

Aug 2, 2010

I'm having trouble figuring out how to list the contents of a directory and exclude any subdirectories.

View 5 Replies View Related

Software :: List Files/directory Names Without Directory Contents?

May 3, 2011

When I run "ls -al somedir*" (I use the "ll" shortcut, actually), Linux not only list files that match, but also the contents of directories whose name also happens to match.Is there a way to limit "ls" so that it will only show names (files and directories) and ignore the contents of the directories?

View 2 Replies View Related

General :: List The Contents Of Directory?

Mar 12, 2010

1 List the contents of directory, /dev using a detail listing format and page by page.

2Mount the CDROM to the directory, /media/cdrom.

3 Delete the file "/home/student/myfile" without any confirmation (Assume you have the required file permission to delete this file).

View 1 Replies View Related

General :: Copy Contents Of One Directory Into Another

Jul 7, 2011

I would like to copy the contents of a directory into another. I don't want to copy the directory and all files and directories under it, but just the contents of the directory just as if it were a regular file. Doing cp -r target dest copies the directory and the entire hierarchy rooted in it. I get error if I do not include the -r option. (I am calling cp from within a C program.)

View 3 Replies View Related

General :: Copy A Directory Without It's Contents?

Nov 5, 2009

Is there a way to copy a directory (retaining the permissions and owners) without copying the contents of the directory?

If there is no such thing... then I need a way to determine if a target path is a file or a directory, and if it is a directory I need to make a new directory elsewhere that has the same name, owner and permissions.

Basically, I'm trying write a script to copy 200 GB of files over a network to a new server, and I'd like to do it by generating a list with the find command. That way, I can migrate large chunks of the files over the course of a week, and on the day of the migration generate a new list of files that changed in the last week and then copy just the chagned files over minimizing the down time. However, the list will contain directories that I can't just use the 'cp' command on because it will copy all the contents of the directory.

View 5 Replies View Related

Software :: Copy A Directory Without Contents

Apr 28, 2009

Is there a way to copy a directory without copying the contents, but preserving ownership, timestamp etc of that directory?

I've looked at the cp man page, but I don't think it supports it. I'm thinking one would have to write a script to gather the info, and then mkdir, chown and touch. Does this seam right?

View 2 Replies View Related

Software :: Copy The Contents Of One Directory To Another?

Mar 10, 2010

I am trying to copy the contents of one directory to another

rsync -av /old /new

when I do this /old is being copied into new

/new/old/files from old

but what I want is the files from old to be moved to new

/new/files from old

how can I do this?

View 2 Replies View Related

General :: Listing TAR Contents Inside Directory

Jun 16, 2011

This is the script I'm running
tar tf some.tar somefolder_insidetar
And output it's a list with all folders, files, and SUBDIRECTORY Files, the only thing I need it's just show the contents (folder and files) of the current directory choosed, not listing subdirectory files, or subdirectories inside subdirectories.

View 3 Replies View Related

Debian :: Contents Of Directory Gone After Accidentally Copying Symlin / Fix It?

Jan 17, 2011

While doing some tidying up, in the process of moving some directories off my temporary mint kde desktop, I lost the contents of an important data directory on my data partition. Just to try to explain a bit of background, I have been using mint kde4 as a stopgap measure until I got squeeze working again ( i have been having graphics problems) and had a symlink on the desktop to a /data directory on my data partition. As I just got squeeze working again, I was moving stuff that had accumulated on the mint desktop to a directory named /2010 in the /data directory on the data partition, but accidently copied/pasted the /data symlink along with the 3 other directories I had highlighted. So effectively, I was accidentally copying the /data symlink to /data/2010. For reasons I don't understand, the whole of the contents of the /data directory disappeared, and it is now totally empty. I thought, that cannot happen can it? So I opened gparted and sure enough, that partition, which previously had about 70 gb of data in the /data directory was empty apart from /lost+found and an odd text file I had stored there. The /data directory is still there, but empty. I shut down Mint and booted into squeeze, thinking it must be a mistake, but gparted shows it has all gone. How on earth can this happen? I have some of the data backed up but a fair bit of the recent stuff isn't, so I need to recover it. I hoped the file system check that happened when I booted back into squeeze would maybe repair anything that got broke, but it showed as clean during boot.

View 5 Replies View Related

General :: How To Prevent Other Users From Seeing Contents Of Home Directory

Jul 8, 2010

I have a box with multiple users on it and I want everyone to be able to have full access to their home folders, but not be able to see the contents of /home/ or another user's home folder (I.E. bob has full access to /home/bob but cannot access or even see the contents of /home/john)Right now users can see other user's home folders but can't modify what's inside. How do I prevent them from seeing the contents at all?

View 1 Replies View Related

Ubuntu :: How To Have Desktop Display Contents Of HOME Directory

May 24, 2010

I am just coming to GNOME from KDE where I used the folder view desktop widget to display the contents of ~ directory (/home/<user>) rather than the "Desktop" directory itself, as that's where all the stuff I wanted to access from the desktop was. Is there any way I can do this in GNOME with the actual desktop (as opposed to a widget)?

View 4 Replies View Related

General :: Copy Contents Of Home Directory To Other Users?

May 3, 2011

I've created other users in my machine. now I want to add all my home directory contents and settings to the home directory of other users. how can i do that? Can I do it from /etc/skel directory?

View 1 Replies View Related

General :: Zip -x For A Directory - Subfolder Contents Not Being Excluded Recursively?

Dec 9, 2010

I am attempting to use the zip command with the '-x' option to exclude a folder e.g. 'zip upload.zip public_html -x public_html/jquery/*'. However, parts of this folder are still being added to the archive. I made a shell script (saved as 'compress.sh' and ran as '. compress.sh') to do the archiving so I could test adding nested wildards for multiple subfolder levels.

Code:

#!/bin/bash
rm -f upload.zip
zip -r upload.zip public_html
-x public_html/jquery

[code]....

Each new line I added here that has the nested wildcards made the archive file size a bit smaller. Adding more /*'s than this didn't affect the file size. Even after all this though, there were still a couple megabytes of files and folders from the 'jquery' directory that were added to the archive.

Here's some examples of files and folders that were created after I unzipped the archive:
public_html/jquery/js/tablesorter/addons/pager/icons [folder]
public_html/jquery/js/tablesorter/addons/pager/.svn/entries [file]
public_html/jquery/js/tablesorter/build/.svn/text-base/js.jar.svn-base [file]

Why is it that despite all the -x lines, the files and folders like these were still being added to the archive? How can I simply recursively exclude the entire public_html/jquery folder from the archive?

View 4 Replies View Related

Server :: Possible To Copy Directory Contents For Data Transfer

May 2, 2010

I have a server that I wanted to transfer it to a newer one both of them have CentOS but the newer one kernel is more up to date I wanted to know is it possible just to copy some directory contents exactly to another for transferring the server data (for example /var /usr /bin /home /etc). I have one website on my server with its mysql database

View 4 Replies View Related

Ubuntu Multimedia :: Play A Directory And Have The Contents Payed Randomly?

Nov 17, 2010

ubuntu 10-04 vlc 1.1.4.1

Is it possible to play a directory and have the contents payed randomly.

I can handle the directory selection but cant find how to make it random.

View 9 Replies View Related

CentOS 5 :: Move Contents Of A Directory Recursively Including Hidden?

Mar 9, 2010

I have a directory: /var/www/html/something/

and it's got tons of files and directories, some containing hidden files.

I want to move all the contents of something including hidden files up to the site root at: /var/www/html/

What is the proper command for this?

View 4 Replies View Related

Fedora :: Contents Of Home Directory Appearing On Desktop / Change It Back?

Nov 2, 2009

When I booted up this morning the contents of my Home directory are all showing up on my desktop, and there is no single Home folder. How did this change, and how can I change it back so that the Home folder is on my Desktop with the contents inside of *it*?

View 5 Replies View Related

Applications :: Scp Copy A Directory And Its Contents From A Remote Machine To Local Host

Oct 8, 2010

For the life of me I can not figure out what I am doing wrong with scp to copy a directory and its contents from a remote machine to my local host. I have no issues with getting a single file but would like to just save time and get the whole folder in one command.

Here is what I have tried:

scp user AT remoteMachine:/home/username/folderIwant user AT localMachine:/folderIwant this gives me a permission denied error and try again and received disconnect from localHost to many authentication failures

scp user AT remoteMachine:home/username/folderIwant . says can not find file or folder

I am sure this is something easy that I cant remember, and searches gives me local to remote not remote to local and trying to make the local to remote suggestions I read to work remote to local have not worked.

View 2 Replies View Related

Fedora :: Corrupt .gvfs Directory - List The Contents Of /home/Razorblade Folder - Nothing

May 4, 2010

I installed Fedora 12 x64. Now everytime I start my Linux the .gvfs directory in my /home/Razorblade -dir is corrupted. So I have to reboot and start an Linux LiveCD, mount my home partition and delete this folder. After that I can login normally. Symptoms: I am able to login normally, start a browser, start my mail client, list the contents of subfolders of /home/Razorblade/... - everything fine. But as soon as I want to list the contents of my /home/Razorblade folder - nothing but this turning blue thing around the curser. The command line does nothing after "ll /home/Razorblade", sometimes even crashes and closes. As root I am able to do "ll /home/Razorblade" And this is what I get:

[Code]....

View 7 Replies View Related

General :: BASH Script To Copy Contents Of Directory So Long As Average System Load Low?

May 26, 2010

For reasons I won't get into, I need to copy directories so long as the average system load is low. Can someone help me write a BASH script that will copy the contents of a directory, but check to make sure the average system load is below X before copying each file, and if not, wait Y seconds and try again?

View 3 Replies View Related

Programming :: CD/DVD Contents Are Not Auto Refreshing ?

Jun 28, 2011

When I eject CD from CDROM by pushing eject button(mounted on CDROM) it still shows CD and it's contents in nautilus file browser. If I replaced the CD it still shows contents of older CD. If I eject CD manually by file browser then there is no such issue. I know this is the kernel issue because this issue has come after updating my kernel from linux 2.6.33 to linux-netbook-2.6.35. I am using MeeGo. I want to know which kernel parameter(or module) I have to add.

View 7 Replies View Related

Programming :: Locate A File By It's Contents?

Jul 16, 2011

A long time ago I wrote a short essay about the 'federal' 'reserve' board. I don't remember it's name or format. I think it's somewhere on my rather large hard discs (to of them divided into various partitions).I'm trying to write a command line that will find it based on a quote that is in it: "our fathers brought forth"I have tried various configurations of grep, and or combining grep with find, but I'm getting nowhere. I really don't understand the syntax of either command, or how they work together, and the examples that I can find are really no help at all.

View 6 Replies View Related

Programming :: Read The Contents Of A File?

Jan 11, 2010

I am trying to read the contents of a file into something else. I have a file.txt that I am working with, I want to read the file and take the data and run some commands with the data that it read. So if it read www.yahoo.com I want to be able to nslookup. Does that make sense? I have been trying to use the read command but that does not seem to work. I even was trying to read filename | > filename to see if I could even read any of the data at all. Nothing is working.

View 8 Replies View Related

Programming :: Watching File Contents Continously?

May 27, 2010

want to watch the file continoulsy for any newly written data to file.Presently i am periodically opening the file and checking for the newly updated contents.Is there something like refresing the file descriptor, since open is a system call, calling it many times may affect performance. Does the tail program opens file multiple times to check for the updated contents when used with -f option.Can some one explain or give some links on how the filedescriptors remembers its end contents while some other programs keeps updating the file.

View 5 Replies View Related

Programming :: BASH: Listing Contents Of .zip File Into An Array?

May 18, 2010

I want to list the contents of a zip file amd put each entry into an array. I've been doing

[code]....

View 4 Replies View Related

Programming :: C Scanf Arbitrarily Deletes Contents Of Another Variable?

Oct 3, 2009

I am in the process of writing a program that plays the game mancala. I wanted to create a function that requires the player to choose a number between one and six, should be simple right? I kept having problems, so I started testing stuff out.

Code:

#include <stdio.h>
#include <stdlib.h>
short move();

[code]....

I am using gcc version 4.3.2 (Debian 4.3.2-1.1). On a whim, I tried something else out; when I change the 'short' variables to 'int' , the problem seems to dissapear.... I tried changing the format string in the scanf statement from "%d" to "%u" which is listed as the appropriate string for the 'short' type, still no luck.

View 13 Replies View Related

Programming :: Read Text File (Distribute Its Contents)

Jan 22, 2011

How can read the file /var/etc/allInOne.cfg and distribute its contents on multiple cfg files using C language. /var/etc/allInOne.cfg contain the data and the path of each text file.

The source file "/var/etc/allInOne.cfg "look like this:
line1
line2
...
line10
filePath:/var/etc/file1.cfg
line12
line13
...
line14
filePath:/var/etc/file2.cfg
linen
..
filePath:/var/etc/filen.cfg
the result will be :

The expected result is:
/var/etc/file1.cfg will contain line1 to line10
/var/etc/file2.cfg will contain line 12 to line13
/var/etc/filen.cfg will contain linen to linen-1

View 13 Replies View Related

General :: Copy Folder Hierarchy / Recreate All Folders From One Directory Without Copying Over Contents Of Folder?

Jul 2, 2010

Is there a way to recreate all the folders from one directory to another without copying over the contents of the folder? I've been trying to do something like this,

Code:for i in `ls $X`; do mkdir $PATH/$i; doneUnfortunately $i is deliminated by whitespaces in the filenames and not the actual folders.

$X contains only other folders so I dont have to worry about regular files but any kind of more "advanced" solution would work.

View 1 Replies View Related

Programming :: Insert A Comment In Html File Based On Its Contents?

Jun 10, 2010

I have multiple HTML files in a folder. there is a <h2> tag like this:

Code:

<h2>some text</h2>

in each file. I want to write a shell script/batch file to add this tag in <head> section of each file:

Code:

<!-- TITLE= "same text from h2 tag" -->

Note that <h2>some text</h2> in some files has 1 or more linebreaks and so I couldn't capture tag content using a simple grep or...
for example:

<h2>first part of text
second line of text</h2>

The line break shouldn't be shown in <!-- TITLE= "same text from h2 tag" -->. The script has to capture tag content & skip line breaks.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved