Cisco Packet Tracer Extensions API 8.1.0
API for communication between Cisco Packet Tracer application and its extension applications and modules.
Public Member Functions | List of all members
Directory Class Reference

Directory is the directory of the file systems for routers and switches. More...

Inheritance diagram for Directory:
File FileSystem

Public Member Functions

int getFileCount ()
 Returns the number of files in the file system. More...
 
File getFileAt (int)
 Returns the file at the specified index. More...
 
File getFile (string)
 Returns the file with the specified filename. More...
 
bool fileExist (string)
 Returns if a file exist in the file system. More...
 
int getSpaceUsed ()
 Returns the amount of space used on this file system. More...
 
bool addFile (File, bool)
 Add file into filesystem. More...
 
bool addTextFile (string, string, bool)
 Add text file into filesystem. More...
 
bool addDirectory (string, bool)
 Add directory into filesystem. More...
 
bool addHttpPage (string, string, bool)
 Returns true if the HTTP page was added successfully, false otherwise. More...
 
bool copyAllFilesFrom (Directory, bool)
 Copy all files from another directory. More...
 
bool removeFile (string, bool)
 Returns true if the file was removed successfully, false otherwise. More...
 
bool removeAllFiles (bool)
 Returns true if all files were removed successfully, false otherwise. More...
 
bool renameFile (string, string, bool)
 Returns true if the file was renamed successfully, false otherwise. More...
 
void fileAdded (string)
 This event is emitted when a file is added successfully. More...
 
void fileRemoved (string)
 This event is emitted when a file is removed successfully. More...
 
void fileRenamed (string, string)
 This event is emitted when a file name is changed successfully. More...
 
- Public Member Functions inherited from File
string getName ()
 Returns the filename of the file. More...
 
FilePermission getPermission ()
 Returns the permissions of the file. More...
 
bool isExecutable ()
 Returns true if the file is executable, otherwise false. More...
 
bool isWritable ()
 Returns true if the file is writable, otherwise false. More...
 
bool isReadable ()
 Returns true if the file is readable, otherwise false. More...
 
bool isDirectory ()
 Returns true if the file is a directory, otherwise false. More...
 
int getSize ()
 Returns the filesize of the file. More...
 
Directory getParent ()
 Returns the parent directory. More...
 
string getAbsPath ()
 Returns absolute path of the File object. More...
 
void setTextContent (string, bool)
 set the content of the File object. More...
 
FileContent getContent (bool)
 Returns the file content of the File. More...
 

Detailed Description

Directory is the directory of the file systems for routers and switches.

Member Function Documentation

◆ addDirectory()

bool Directory::addDirectory ( string  ,
bool   
)

Add directory into filesystem.

Parameters
name,Directoryname
bCheckPermission,trueif write permission needs to be checked and false if otherwise
Returns
bool, true if the file was added successfully and false if not

◆ addFile()

bool Directory::addFile ( File  ,
bool   
)

Add file into filesystem.

Parameters
file,Fileobject of the file to check
bCheckPermission,trueif write permission needs to be checked and false if otherwise
Returns
bool, true if the file was added successfully and false if not

◆ addHttpPage()

bool Directory::addHttpPage ( string  ,
string  ,
bool   
)

Returns true if the HTTP page was added successfully, false otherwise.

Parameters
name,thename of the HTTP page.
content,thecontent of the HTTP page.
bCheckPermission,trueto check permissions, false to skip.
Returns
bool, true if the HTTP page was added successfully, false otherwise.

◆ addTextFile()

bool Directory::addTextFile ( string  ,
string  ,
bool   
)

Add text file into filesystem.

Parameters
name,Filename
content,filecontent
bCheckPermission,trueif write permission needs to be checked and false if otherwise
Returns
bool, true if the file was added successfully and false if not

◆ copyAllFilesFrom()

bool Directory::copyAllFilesFrom ( Directory  ,
bool   
)

Copy all files from another directory.

Parameters
dir,thedirectory object to copy files from
bCheckPermission,trueif write permission needs to be checked and false if otherwise
Returns
bool, true if the files were copied successfully and false if not

◆ fileAdded()

void Directory::fileAdded ( string  )

This event is emitted when a file is added successfully.

Parameters
fileName,thefile name of the file that was added

IPC event.

◆ fileExist()

bool Directory::fileExist ( string  )

Returns if a file exist in the file system.

Parameters
name,filename
Returns
bool, true if exists and false if not

◆ fileRemoved()

void Directory::fileRemoved ( string  )

This event is emitted when a file is removed successfully.

Parameters
fileName,thefile name of the file that was removed

IPC event.

◆ fileRenamed()

void Directory::fileRenamed ( string  ,
string   
)

This event is emitted when a file name is changed successfully.

Parameters
oldFileName,theold file name of the file
newFileName,thenew file name of the file

IPC event.

◆ getFile()

File Directory::getFile ( string  )

Returns the file with the specified filename.

Parameters
filename,thefilename of the file.
Returns
File, the File object with the associated filename.

◆ getFileAt()

File Directory::getFileAt ( int  )

Returns the file at the specified index.

Parameters
index,theindex of the file of interest.
Returns
File, the File object at the specified index.

◆ getFileCount()

int Directory::getFileCount ( )

Returns the number of files in the file system.

Returns
int, the number of files in the file system.

◆ getSpaceUsed()

int Directory::getSpaceUsed ( )

Returns the amount of space used on this file system.

Returns
int, the amount of space used on this file system.

◆ removeAllFiles()

bool Directory::removeAllFiles ( bool  )

Returns true if all files were removed successfully, false otherwise.

Parameters
bCheckPermission,trueto check permissions, false to skip.
Returns
bool, true if all files were removed successfully, false otherwise.

◆ removeFile()

bool Directory::removeFile ( string  ,
bool   
)

Returns true if the file was removed successfully, false otherwise.

Parameters
name,thename of the file of interest.
bCheckPermission,trueto check permissions, false to skip.
Returns
bool, true if the file was removed successfully, false otherwise.

◆ renameFile()

bool Directory::renameFile ( string  ,
string  ,
bool   
)

Returns true if the file was renamed successfully, false otherwise.

Parameters
oldName,theold file name
newName,thenew file name.
bCheckPermission,trueto check permissions, false to skip.
Returns
bool, true if the file was renamed successfully, false otherwise.

The documentation for this class was generated from the following file: