> Benoît Minisini schrieb: > >> Just found this (Gambas 2 project) when copying several students from > >> one class into another. For each student, there are about 6 files to be > >> copied from one directory into another. The first one will always get > >> standard chgrp and chown of the application's user. The other files > >> SOMETIMES are copied with correct group and ownership, MOSTLY not. > >> > >> All files have special group and ownership, controlling if teachers or > >> only the office can access the data. > >> > >> Now, this is the function that does the actual copy: > >> > >> > >> > >> 'kopiert alle Dateien eines Namens in eine andere Kartei > >> '- ziel ist der Zielpfad > >> '- wenn eine gleichnamige Datei schon vorhanden ist, kommt "-1" zurück > >> '- wenn es geklappt hat, kommt "0" zurück > >> > >> 'wird z. B. von dlgNamenKopieren benutzt > >> > >> PUBLIC FUNCTION NamenKopieren(schlyssel AS String, ziel AS String) AS > >> Integer > >> DIM original AS String > >> DIM odatei AS String > >> DIM opfad AS String > >> DIM datei AS String > >> > >> original = getFilename(schlyssel) > >> > >> odatei = file.BaseName(original) > >> opfad = file.Dir(original) > >> > >> IF Exist(ziel &/ odatei & ".felder") THEN > >> RETURN -1 > >> END IF > >> > >> FOR EACH datei IN Dir(opfad, odatei & ".*") > >> COPY opfad &/ datei TO ziel &/ datei > >> NEXT > >> > >> RETURN 0 > >> > >> END > >> > >> > >> Do you see anything wrong here? As it sometimes works correctly I would > >> actually think that it's a bug in copy. > >> > >> The filesystem is ext3. > >> > >> Regards > >> > >> Rolf > > > > COPY actually does the same thing as opening the input file, opening the > > output file, reading the data, writing the data, closing the input gile, > > closing the output file. > > > > So the output file will have the same authorizations as the input file, > > except that they are filtered by the "umask" (man umask) and that the > > file will be owned by the process who wrote the file. > > > > COPY is there just for simple cases. > > > > I suggest you use the "cp" command, using the "--preserve" option. > > > > Regards, > > Ahh - ok. Wouldn't it be possible to pimp COPY giving it a special > "preserve" option which would take care about this? >
Yes but no. Why trying to rewrite "cp"? I even don't know why I wrote COPY. :-) I don't want the interpreter to be too big. So maybe a component dedicated to file operations? -- Benoît ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user