473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Remove a UNIX hidden file using boost::filesystem

Hello all,

I'm trying to remove a hidden file (in UNIX) using the
Boost::filesystem library.
This is what I have:
#include <boost/filesystem/operations.hpp>

namespace fs=boost::filesystem;

my_func()
{
fs::remove(fs::path("/path/to/.hiddenfile")); // this file
exists, and I have permissions to write it
}
And I get this error:
terminate called after throwing an instance of
'boost::filesystem::filesystem_error'
what(): boost::filesystem::path: invalid name ".hiddenfile" in
path: "/path/to/.hiddenfile"
Do you know what is wrong?
Is there any other way for doing this?

Thanks.

Oct 5 '07 #1
2 4563
On Fri, 05 Oct 2007 03:55:27 -0700, Javier wrote:
I'm trying to remove a hidden file (in UNIX) using the
Boost::filesystem library.
Your question is not relevant to the C++ language in general,
but it covers an issue with the boost::filesystem library.
Check for support groups of boost::filesystem instead.
The comp.lang.c++ group is for C++ language issues.

--
Joel Yliluoma - http://bisqwit.iki.fi/
: comprehension = 1 / (2 ^ precision)
Oct 5 '07 #2
On Fri, 05 Oct 2007 03:55:27 -0700, Javier wrote:
Hello all,

I'm trying to remove a hidden file (in UNIX) using the Boost::filesystem
library.
This is what I have:
#include <boost/filesystem/operations.hpp>

namespace fs=boost::filesystem;

my_func()
{
fs::remove(fs::path("/path/to/.hiddenfile")); // this file
exists, and I have permissions to write it }
And I get this error:
terminate called after throwing an instance of
'boost::filesystem::filesystem_error'
what(): boost::filesystem::path: invalid name ".hiddenfile" in
path: "/path/to/.hiddenfile"
Do you know what is wrong?
Is there any other way for doing this?
Not sure whether that has anything to do with your problem but to delete
a file on UNIX and UNIX-like systems you usually need write permissions
to the directory the file is in not the file itself (unless the sticky
bit is set on the directory).

--
Markus Schoder
Oct 5 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: perseus | last post by:
It is really crazy! I need to use the Boost filesystem for the manipulation of directories, and I have no idea how to install this filesystem on my IBM-compatible machine. Does anyone up here know...
3
by: Michael | last post by:
Is this the correct place to ask about Boost libs? If it is.............. #include <boost/filesystem/path.hpp> #include <boost/filesystem/operations.hpp> using namespace boost; using...
4
by: Christian Blackburn | last post by:
Hi Gang, I've created a text-based file format. Once I've generated the text to save the file is as it should be in the debug window. However once I write it to a file a " is added to the...
2
by: jhasse | last post by:
How can I create spaces with the create_directory() function?? When i use this boost::filesystem::create_directory("bla bla"); it throws. When I user ...
12
by: Daz | last post by:
Hi everyone. I am not sure of where best to post this message. I have spent 2 days now trying to answer this question to no avail, and I am gradually reaching the end of my tether. I am trying...
8
by: Daz | last post by:
Hi Everyone. I am sturggling trying to find out a way in which I can delete a 'path' object. I may not need to delete it, however, I need to overwrite it. The function I am trying to code,...
0
by: mail | last post by:
Hi Is it possible to edit an asp file using filesystem? when I read a text file using filesystem it doesnt show me the asp code in the <% tags as this code is run server side, but is there a way...
5
by: GaryE | last post by:
Hello: I am having trouble linking a couple of files using the boost::filesystem. I am using MSVC 6.0. Here is an abbreviated version of my problem: foo.h: #ifndef __FOO_ #define...
0
by: vaibhav83 | last post by:
hi, can anyone tell me how to convert an excel sheet into xml using filesystem object in VBE. does the data in sheet comes automatically into xml or we must input it manually. the os used is winxp...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.